Absolute Xpath to get list of childnodes?
Posted
by Googler
on Stack Overflow
See other posts from Stack Overflow
or by Googler
Published on 2010-05-05T07:33:12Z
Indexed on
2010/05/05
7:48 UTC
Read the original article
Hit count: 228
Hi this my xml file,
<?xml version="1.0"?>
<worldpatentdata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<meta name="elapsed-time" value="329" xmlns="http://ops.epo.org"/>
<exchange-documents xmlns="http://www.epo.org/exchange">
<exchange-document country="AT" doc-number="380509" family-id="38826527" kind="T" system="ops.epo.org">
<bibliographic-data>
<publication-reference data-format="docdb">
<document-id>
<country>AT</country>
<doc-number>380509</doc-number>
<kind>T</kind>
<date>20071215</date>
</document-id>
</publication-reference>
<parties>
<applicants>
</applicants>
<inventors>
</inventors>
</parties>
</bibliographic-data>
</exchange-document>
</exchange-documents>
</worldpatentdata>
For the above xml file, i need the xpath to receive the childnodes below it:
Output i need is :
<exchange-documents xmlns="http://www.epo.org/exchange">
<exchange-document country="AT" doc-number="380509" family-id="38826527" kind="T" system="ops.epo.org">
<bibliographic-data>
<publication-reference data-format="docdb">
<document-id>
<country>AT</country>
<doc-number>380509</doc-number>
<kind>T</kind>
<date>20071215</date>
</document-id>
</publication-reference>
<parties>
<applicants>
</applicants>
<inventors>
</inventors>
</parties>
</bibliographic-data>
</exchange-document>
I using Linq-Xml to get the following data:
This is my Xpath and code:
var list = doc1.XPathSelectElement("exchange-document");
I couldnt retreive the needed output.It returns null for the above code. Can anyone pls help on this by providing the correct xpath to retieve the child nodes. Else is there any other way to retrieve it.
© Stack Overflow or respective owner