-
Feature Request
-
Resolution: Duplicate
-
Major
-
None
-
2.15.2.Final
-
None
I am using the nice XMLParser API from
https://github.com/forge/xml-parser
But having a Node, I need to add a new child node at a specific order. Today the child node is added at the end. But my XSD has a structure so I must add the child node at a given position.
I cannot find an api to do that. I may have to remove all child nodes, and rebuild the structure in the order I need. But I think that is a bit drastic - would be nice if there was an api to do that.
For example a addSibling method that creates a sibling node, and inserts it just after current node, eg
If the children is
A,B,C,D,E,F
And then I want to add a C2, I can do
Node c = ...
c.addSibling("C2);
And then we have
A,B,C,C2,D,E
Node camel = ... for (Node child : camel.getChildren()) { ... logic here if (yeah) { Node newEndpoint = child.addSibiling("endpoint); newEndpoint.attribute("id", "foo"); newEndpoint.attribute("url", "bla bla"); } }
- duplicates
-
FORGE-998 xml-parser: Ability to insert an xml node after or before another one
-
- Open
-