How do I get XML path by its value?

Posted by user299938 on Stack Overflow See other posts from Stack Overflow or by user299938
Published on 2010-03-23T13:33:06Z Indexed on 2010/03/23 13:43 UTC
Read the original article Hit count: 317

Filed under:
|

I need to get the xml path opf the xml file by providing the value of an xml child element as the input.

For example:

XML file:

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

For the above XML file. I need to get the XML path by using the value "1000". If my input is value of the element "1000" Output i need is :

 <document-id>
        <country>EP</country>
        <doc-number>1000</doc-number>
        <kind>A1</kind>
  </document-id>

I need to achieve this using c# code. Can anyone please help me out on this...

© Stack Overflow or respective owner

Related posts about Xml

Related posts about c#