Skip to content

Commit

Permalink
Fixing issue where superfluous sub-elements where created.
Browse files Browse the repository at this point in the history
  • Loading branch information
tHerrmann committed Jan 2, 2014
1 parent 624e918 commit 743ac6d
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -319,25 +319,27 @@ private static Element handleNode(Element parent, String xpathName) {
handleNode(elem, childrenPart);
return elem;
}
Map<String, String> children = CmsStringUtil.splitAsMap(childrenPart, "][", "=");
// handle child nodes
for (Map.Entry<String, String> child : children.entrySet()) {
String childName = child.getKey();
String childValue = child.getValue();
if (childValue.startsWith("'")) {
childValue = childValue.substring(1);
}
if (childValue.endsWith("'")) {
childValue = childValue.substring(0, childValue.length() - 1);
}
if (childName.startsWith("@")) {
elem.addAttribute(childName.substring(1), childValue);
} else if (childName.equals("text()")) {
elem.setText(childValue);
} else if (!childName.contains("(")) {
Element childElem = elem.addElement(childName);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(childValue)) {
childElem.addText(childValue);
if (childrenPart.contains("=")) {
Map<String, String> children = CmsStringUtil.splitAsMap(childrenPart, "][", "=");
// handle child nodes
for (Map.Entry<String, String> child : children.entrySet()) {
String childName = child.getKey();
String childValue = child.getValue();
if (childValue.startsWith("'")) {
childValue = childValue.substring(1);
}
if (childValue.endsWith("'")) {
childValue = childValue.substring(0, childValue.length() - 1);
}
if (childName.startsWith("@")) {
elem.addAttribute(childName.substring(1), childValue);
} else if (childName.equals("text()")) {
elem.setText(childValue);
} else if (!childName.contains("(")) {
Element childElem = elem.addElement(childName);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(childValue)) {
childElem.addText(childValue);
}
}
}
}
Expand Down

0 comments on commit 743ac6d

Please sign in to comment.