Skip to content

Commit

Permalink
Restord xml:space attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
rmraya committed Dec 30, 2019
1 parent 5364a41 commit 7100762
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Binary file modified lib/openxliff.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/com/maxprograms/converters/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private Constants() {
public static final String TOOLID = "OpenXLIFF";
public static final String TOOLNAME = "OpenXLIFF Filters";
public static final String VERSION = "1.7.0";
public static final String BUILD = "20191230_1249";
public static final String BUILD = "20191230_1446";

public static final String SUCCESS = "0";
public static final String ERROR = "1";
Expand Down
7 changes: 7 additions & 0 deletions src/com/maxprograms/xliff2/FromXliff2.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,17 @@ private static void recurse(Element source, Element target) {
Element joinedSource = new Element("source");
Element joinedTarget = new Element("target");
boolean approved = true;
boolean preserve = false;

List<Element> children = source.getChildren();
Iterator<Element> et = children.iterator();
while (et.hasNext()) {
Element child = et.next();
if (child.getName().equals("segment") || child.getName().equals("ignorable")) {
Element src = child.getChild("source");
if (src.getAttributeValue("xml:space","default").equals("preserve")) {
preserve = true;
}
joinedSource.addContent(src.getContent());
Element tgt = child.getChild("target");
if (tgt != null) {
Expand All @@ -252,6 +256,9 @@ private static void recurse(Element source, Element target) {
if (approved) {
transUnit.setAttribute("approved", "yes");
}
if (preserve) {
transUnit.setAttribute("xml:space", "preserve");
}

Element src = new Element("source");
List<XMLNode> nodes = joinedSource.getContent();
Expand Down

0 comments on commit 7100762

Please sign in to comment.