RETRIVE XPATH OF AN XML ELELEMNT BY USING ITS VALUE

Posted by user299938 on Stack Overflow See other posts from Stack Overflow or by user299938
Published on 2010-03-24T06:43:41Z Indexed on 2010/03/24 7:03 UTC
Read the original article Hit count: 476

Filed under:
|

My XmlFile looks like this:

<?xml version="1.0"?> <document-inquiry> <publication-reference data-format="docdb" xmlns="http://www.epo.org/exchange"> <document-id> <country>EP</country> <doc-number>2160088</doc-number> <kind>A1</kind> </document-id> </publication-reference>
</document-inquiry>

For the above xml i need to get the xpath of a specific element say for example "country element" as

My Output: "/document-inquiry/publication-reference/document-id/country"

My Input : By using its value "EP"

This is the code i tried

doc.SelectSingleNode("/document-inquiry/publication-reference/document-id[text()='EP']");

I receivev null for the above code.

I have to get it using the c# code. Can anyone pls help me on this

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xml-serialization