darma teja

darma teja

  • NA
  • 496
  • 336.6k

find the word and replace it with ascending number in xml

Aug 11 2016 7:21 AM
Hi All,
 
my XML file is like this:
<root>
<node1>
<test1></test1>
<test2><test11 id="Name45" guid="blabla02"/></test2>
</node1>
<test id="Name1" guid="blabla"/>
<test3>
<test31 id="Name00" guid="blabla1"/>
</test3>
<test4>
<app><test41 id="Name60" guid="blabla1"/></app>
</test4>
<test5>
<app><test51 id="Name00" guid="blabla1"/></app>
</test5>
</root>
I would like to search for word "Name(number)" and replace theses Names with ascending order.
Example output:
<root>
<node1>
<test1></test1>
<test2><test11 id="Name1" guid="blabla02"/></test2>
</node1>
<test id="Name2" guid="blabla"/>
<test3>
<test31 id="Name3" guid="blabla1"/>
</test3>
<test4>
<app><test41 id="Name4" guid="blabla1"/></app>
</test4>
<test5>
<app><test51 id="Name5" guid="blabla1"/></app>
</test5>
</root>
Thanks,
Darma 

Answers (3)