EDN Admin
Well-known member
Hi,
I have a response file which is returned by my server in xml format.
I have to read and traverse the file and get all the xpaths from the xml file.
say I have the below data from xml
<stationary>
<books>
<book name ="c#" price="200$" publisher="X" author="a"/>
<book name ="java" price="300$" publisher="y" author="b"/>
<book name ="perl" price="400$" publisher="z" author="c"/>
</books>
<pencils>
<pencil name="bold" price="5$ " manufacturer="a" />
<pencil name="dark" price="5$ " manufacturer="a" />
<pencil name="lite" price="5$ " manufacturer="a" />
</pencils>
...
...
</stationary>
Now I have to display all the possible xpaths and attributes of the leaf nodes in the below format
/stationary/books/book
name="c#" price="200$" publisher="X" author="a"
/stationary/books/book
name="java" price="300$" publisher="y" author="b"
...
...
/stationary/pencils/pencil
name="dark" price="5$ " manufacturer="a"
/stationary/pencils/pencil
name="dark" price="5$ " manufacturer="a" etc
Can you please help me out in displaying all the possible xpaths in the above format.
Thanks in advance
Sam
View the full article
I have a response file which is returned by my server in xml format.
I have to read and traverse the file and get all the xpaths from the xml file.
say I have the below data from xml
<stationary>
<books>
<book name ="c#" price="200$" publisher="X" author="a"/>
<book name ="java" price="300$" publisher="y" author="b"/>
<book name ="perl" price="400$" publisher="z" author="c"/>
</books>
<pencils>
<pencil name="bold" price="5$ " manufacturer="a" />
<pencil name="dark" price="5$ " manufacturer="a" />
<pencil name="lite" price="5$ " manufacturer="a" />
</pencils>
...
...
</stationary>
Now I have to display all the possible xpaths and attributes of the leaf nodes in the below format
/stationary/books/book
name="c#" price="200$" publisher="X" author="a"
/stationary/books/book
name="java" price="300$" publisher="y" author="b"
...
...
/stationary/pencils/pencil
name="dark" price="5$ " manufacturer="a"
/stationary/pencils/pencil
name="dark" price="5$ " manufacturer="a" etc
Can you please help me out in displaying all the possible xpaths in the above format.
Thanks in advance
Sam
View the full article