I have an XML document. While reading it using the System.XML.XMLDocument object, I want to retrieve the XPath of each XMLNode that I am reading. Does anyone have any idea how it can be done?
.
Printable View
I have an XML document. While reading it using the System.XML.XMLDocument object, I want to retrieve the XPath of each XMLNode that I am reading. Does anyone have any idea how it can be done?
.
How do you get to the node whose XPath you want to figure out in the first place? Or are you asking how you can use XPath to get a node value?
I am using an XMLDocument object to traverse through the nodes. Now the XML file that I have to process has been structured in a way that some elements are repeated. For e.g. the Customer and Vendor nodes follow the same structure i.e. a Name element, an Address element and a Telephone element. While reading the document I would like to distinguish between the Customer set of elements and the Vendor set of elements. I hope you get the picture.Quote:
Originally Posted by mendhak
Now I could try to do this manually, but it is not proving fruitful. So just wanted to see if there was some way to get the XPath of a particular node when I am reading it off the XMLDocument tree.
.