Hello everyone,
I'm trying to transform this xml to another xml but couldn't quite figure it out.
Source.xml
<all>
<object name="objname" value="objvalue">
<elem1 att="value" att2="value"/>
<elem1 att="value" att2="value"/>
<object name="name" value="645">
<items>
<item itemno="1a" itemname="name"/>
<item itemno="1b" itemname="name"/>
<item itemno="1c" itemname="name"/>
</items>
</object>
<object name="name" value="646">
<items>
<item itemno="2a" itemname="name"/>
<item itemno="2b" itemname="name"/>
<item itemno="2c" itemname="name"/>
</items>
</object>
</object>
</all>
I want to transform the above document to another xml which looks exactly the same except the itemno with value 2b would have a different value say 3b. The <object> element under <all> can have any number of elements. here's the output <all> <object name="objname" value="objvalue"> <elem1 att="value" att2="value"/> <elem1 att="value" att2="value"/> <object name="name" value="645"> <items> <item itemno="1a" itemname="name"/> <item itemno="1b" itemname="name"/> <item itemno="1c" itemname="name"/> </items> </object> <object name="name" value="646"> <items> <item itemno="2a" itemname="name"/> <item itemno="3b" itemname="name"/> <item itemno="2c" itemname="name"/> </items> </object> </object> </all>
I'd appreciate any help from anyone.
Thanks,
Srini
I'm trying to transform this xml to another xml but couldn't quite figure it out.
Source.xml
<all>
<object name="objname" value="objvalue">
<elem1 att="value" att2="value"/>
<elem1 att="value" att2="value"/>
<object name="name" value="645">
<items>
<item itemno="1a" itemname="name"/>
<item itemno="1b" itemname="name"/>
<item itemno="1c" itemname="name"/>
</items>
</object>
<object name="name" value="646">
<items>
<item itemno="2a" itemname="name"/>
<item itemno="2b" itemname="name"/>
<item itemno="2c" itemname="name"/>
</items>
</object>
</object>
</all>
I want to transform the above document to another xml which looks exactly the same except the itemno with value 2b would have a different value say 3b. The <object> element under <all> can have any number of elements. here's the output <all> <object name="objname" value="objvalue"> <elem1 att="value" att2="value"/> <elem1 att="value" att2="value"/> <object name="name" value="645"> <items> <item itemno="1a" itemname="name"/> <item itemno="1b" itemname="name"/> <item itemno="1c" itemname="name"/> </items> </object> <object name="name" value="646"> <items> <item itemno="2a" itemname="name"/> <item itemno="3b" itemname="name"/> <item itemno="2c" itemname="name"/> </items> </object> </object> </all>
I'd appreciate any help from anyone.
Thanks,
Srini