Skip to content

Commit

Permalink
Cleaned Arbortext processing instructions on merge
Browse files Browse the repository at this point in the history
  • Loading branch information
rmraya committed Dec 14, 2024
1 parent 858510a commit 8623948
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Binary file modified lib/openxliff.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sonar.projectKey=OpenXLIFF
# this is the name displayed in the SonarQube UI
sonar.projectName=OpenXLIFF
sonar.projectVersion=3.22.0
sonar.projectVersion=4.0.0

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
Expand Down
2 changes: 1 addition & 1 deletion src/com/maxprograms/converters/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private Constants() {
public static final String TOOLID = "OpenXLIFF";
public static final String TOOLNAME = "OpenXLIFF Filters";
public static final String VERSION = "4.0.0";
public static final String BUILD = "20241214_1706";
public static final String BUILD = "20241214_1748";

public static final String SUCCESS = "0";
public static final String ERROR = "1";
Expand Down
14 changes: 14 additions & 0 deletions src/com/maxprograms/converters/xml/Xliff2Xml.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ private static void changeLanguage(String outputFile) throws SAXException, IOExc
Document doc = builder.build(outputFile);
Element root = doc.getRootElement();
root.setAttribute("xml:lang", tgtLang);
updatePI(root);
Indenter.indent(root, 2);
XMLOutputter outputter = new XMLOutputter();
outputter.preserveSpace(true);
Expand All @@ -289,6 +290,19 @@ private static void changeLanguage(String outputFile) throws SAXException, IOExc
}
}

private static void updatePI(Element e) {
List<PI> pis = e.getPI();
for (int i = 0; i < pis.size(); i++) {
PI pi = pis.get(i);
String data = pi.getData();
pi.setData(data.replace("\n", ""));
}
List<Element> children = e.getChildren();
for (Element child : children) {
updatePI(child);
}
}

private static void recurse(Element e) {
List<XMLNode> content = e.getContent();
for (int i = 0; i < content.size(); i++) {
Expand Down

0 comments on commit 8623948

Please sign in to comment.