I'm using XMLSlurper to parse a XML in Groovy.
An element should be added to the parsed XML (GPathResult instance), but the new element should be at a specific position, after an existing element, to be compliant with the XML Schema.
Right now the only thing that works is to append the new node at the end of the parsed XML, that violates the XSD.
Is there a way to append the new element after an exiting element? Something like "appendSibling()"?
The structure is like this:
<root>
<name>xxx</name>
<state>xxx</state>
</root>
And I need "id" after "name" and under "root":
<root>
<name>xxx</name>
<id>xxx</id>
<state>xxx</state>
</root>