How to get the value from the nodes with the same name without any distinguish attr
input xml:
<rootNode>
--<Node>
----<Name1attribute1="1">
----</Name1>
----<Name2 attribute="2">
----</Name2>
----<Lines attribute="Line1" anotherAtt="I need this one">
----</Lines>
----<Lines nm="second" mn="dnoces">
----</Lines>
----<Lines ...>
----</Lines>
----<Lines q="4" p="th">
----</Lines>
----<Lines ...>
----</Lines>
--</Node>
</rootNode>
output xml:
<root>
--<roo>
----<firstLines a="Line1" b="I need this one"/>
--</roo>
--<oor>
----<fourthLines a="4" b="th"/>
--</oor>
</root>
The input xml has many of the same node "Lines", and their attributes are randomly, which means we can not distinguish them via their attribute(s). Now I only need the first "Lines", how can I achieve this?
What about Nth "Lines", let's say 4th "Lines", how can I just get 4th "Lines"?
Thank you in advance.
Last edited by JohnKiller; August 10th, 2011 at 03:23 PM..
|