Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The insertSiblingAfter() method of OMNodeImpl adds a sibling after the invoked node. If the parent of these nodes is an OMElement and the user invokes the addChild() method then the added sibling is replaced. Consider the following sample.
OMElement parent = fac.createOMElement("parent", null);
OMElement c1 = fac.createOMElement("c1", null);
OMElement c2 = fac.createOMElement("c2", null);
OMElement c3 = fac.createOMElement("c3", null);
parent.addChild(c1);
c1.insertSiblingAfter(c2);
parent.addChild(c3);
System.out.println(parent);
The correct output should be: <parent><c1 /><c2 /><c3 /></parent>
But the we don't get the element c2. The incorrect output we get is : <parent><c1 /><c3 /></parent>