471,348 Members | 1,304 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

XmlDocument.SelectNodes

Hello,

I am using .NET XmlDocument object to load the xml file.
Please look at the below given sample xml file for the refence.
using objXmlDoc.SelectNodes("//bookstore/book/first-name="Jane" and
last-name="Austen") where it should return me the list of (<book...>)Nodes
which has child node first-name="Jane" and last-name="Austen".

Basically I have to fetch list of books based on first AND last name of the
book author.

Thanks in advance

With Regards
Venkat

* This question is posted in xsl group also.

<?xml version="1.0"?>
<bookstore xmlns:bk="urn:samples">
<book genre="novel" publicationdate="1997" bk:ISBN="1-861001-57-8">
<title>Pride And Prejudice</title>
<first-name>Jane</first-name>
<last-name>Austen</last-name>
<price>24.95</price>
</book>
<book genre="novel" publicationdate="1992" bk:ISBN="1-861002-30-1">
<title>The Handmaid's Tale</title>
<first-name>Margaret</first-name>
<last-name>Atwood</last-name>
<price>29.95</price>
</book>
<book genre="novel" publicationdate="1991" bk:ISBN="1-861001-57-6">
<title>Emma</title>
<first-name>Jane</first-name>
<last-name>Austen</last-name>
<price>19.95</price>
</book>
<book genre="novel" publicationdate="1982" bk:ISBN="1-861001-45-3">
<title>Sense and Sensibility</title>
<first-name>Jane</first-name>
<last-name>Austen</last-name>
<price>19.95</price>
</book>
</bookstore>


Feb 22 '06 #1
1 5396
Venkatachalam wrote:
I am using .NET XmlDocument object to load the xml file.
Please look at the below given sample xml file for the refence.
using objXmlDoc.SelectNodes("//bookstore/book/first-name="Jane" and
last-name="Austen") where it should return me the list of (<book...>)Nodes
which has child node first-name="Jane" and last-name="Austen".


Try "//bookstore/book[first-name='Jane' and last-name='Austen']

See http://www.w3schools.com/xpath/ for an XPath tutorial.

Jon

Feb 22 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by pete | last post: by
4 posts views Thread by Roshawn Dawson | last post: by
16 posts views Thread by PiotrKolodziej | last post: by
3 posts views Thread by Stuart Shay | last post: by
1 post views Thread by =?Utf-8?B?RGF2aWRHQg==?= | last post: by
1 post views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.