I am trying to find the xpath of every element in an xml and put it up as the element value. My source file would look like :
<root>
<parent1>
<child1></child1>
<child2></child2>
</parent1>
<parent2>
<child1></child1>
</parent2>
</root>
I wanted an output like:
<root>
<parent1>
<child1> /root/parent1/child1 </child1>
<child2> /root/parent1/child2 </child2>
</parent1>
<parent2>
<child1> /root/parent2/child1 </child1>
</parent2>
</root>
I am currently getting an output as:
<root>
<parent1>
<child1> /root/parent1/child1 </child1>
<child2> /root/parent1/child2 </child2>
</parent1>"
<parent2>
<child1> /root/parent1/parent2/child1 </child1>
</parent2>
</root>
I am unable to traverse properly to find the xpath. Any input would be valuable.
No comments:
Post a Comment