Skip to content

Commit

Permalink
Comment to explain why we use this method of replacmeent.
Browse files Browse the repository at this point in the history
  • Loading branch information
polx committed Mar 2, 2021
1 parent cb68d16 commit 6bd2104
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ private void performTransformations() throws Exception
if (parent == null) {
document = xmlDocument;
} else {
// this is the method we use to replace the child and it seems to be
// the canonical way in dom4j (for which a manipulation on a collection
// is a manipulation of the XML tree: We manipulate the elements' list
// by setting the child at the position where it was found.
List<Element> siblings = parent.elements();
siblings.set(siblings.indexOf(node), xmlElement);
}
Expand Down

0 comments on commit 6bd2104

Please sign in to comment.