I have the fallowing XML:
<?xml version='1.0' encoding='UTF-8'?>
<A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://obe.nce.amadeus.net/bms/metadata/1-0/">
<B name="NAME" version="VERSION">
<AA>SOME NAME</AA>
<CC>SOME OTHER NAME</CC>
</B>
<C>
<SOME1>
<TAG_3 name="NAME_1" path="path_1"/>
<TAG_3 name="NAME_2" path="path_2"/>
<TAG_3 name="NAME_3" path="path_3"/>
</SOME1>
<SOME2>
<TAG_3 name="NAME_4" path="path_1"/>
<TAG_3 name="NAME_5" path="path_2"/>
<TAG_3 name="NAME_6" path="path_3"/>
</SOME2>
</C>
<D>
<TAG_3 type="type" name="NAME_1" version="version_1"/>
<TAG_3 type="type" name="NAME_2" version="version_2"/>
<TAG_3 type="type" name="NAME_3" version="version_3"/>
</D>
</A>
And I have to change it to be something like this:
<?xml version='1.0' encoding='UTF-8'?>
<A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://obe.nce.amadeus.net/bms/metadata/1-0/">
<B name="NAME" version="VERSION">
<AA>SOME NAME</AA>
<CC>SOME OTHER NAME</CC>
</B>
<C>
<!-- SOME1 -->
<TAG_3 name="NAME_1" path="path_1"/>
<TAG_3 name="NAME_3" path="path_3"/>
<TAG_3 name="NAME_2" path="path_2"/>
<!-- SOME2 -->
<TAG_3 name="NAME_5" path="path_2"/>
<TAG_3 name="NAME_4" path="path_1"/>
<TAG_3 name="NAME_6" path="path_3"/>
</C>
<D>
<TAG_3 type="type" name="NAME_1" version="version_1"/>
<TAG_3 type="type" name="NAME_2" version="version_2"/>
<TAG_3 type="type" name="NAME_3" version="version_3"/>
</D>
</A>
Does any of you know how I can achieve something like this? I've tried to do iterate over all the children of SOME1 and SOME2 and remove that tag, but I don't know how to:
- Remove the TAG itself, such as SOME1 and SOME2
- Add the first line of the comment in place of that TAG
Could any of you give me any hint how can I do that?