I am struggling to replace a XML element with another one using the library anti-xml. For instance, I have:
<root>
<sub>
<keep />
<replace />
<keeptoo />
</sub>
</root>
and the fragment:
<inserted key="value">
<foo>foo</foo>
<bar>bar</bar>
</inserted>
I would like to produce:
<root>
<sub>
<keep />
<inserted key="value">
<foo>foo</foo>
<bar>bar</bar>
</inserted>
<keeptoo />
</sub>
</root>
Note: The order of <sub>
children must be conserved.