Click here to Skip to main content
15,880,503 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to convert leaf nodes in any xml document to its XPath expression using Java. Consider as an example xml document named x1 as,

XML
<?xml version="1.0"?>
<article>
<title>xml</title>
<body>
<section>
<title>xml</title>
<p>information</p>
<p>retrieval</p>
</section>
</body>
</article>


This should be converted to the

VB
x1/article[1]/title[1]: "xml"
x1/article[1]/body[1]/section[1]/title[1]: "xml"
x1/article[1]/body[1]/section[1]/p[1]: "information"
x1/article[1]/body[1]/section[1]/p[2]: "retrieval"


Note that XML file could have any namespace and schema.

Please help me. Thanks in advance.
Posted
Comments
Have you tried anything?
ridoy 12-Sep-13 14:30pm    
I think you got a good answer in stackoverflow!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900