Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > XmlNode ParentNode???

Thread Tools

XmlNode ParentNode???

Posts: n/a
I am trying to retrieve title of the parent (post) by the id of the
comment, Why doesn't this work?

<comment id='100'>text</comment>
<comment id='101'>text</comment>

Dim xmlRoot As XmlNode
Dim postId as Integer
xmlRoot = xmldoc.SelectSingleNode("root")
postId = xmlRoot.SelectSingleNode("root/post/

Reply With Quote
Michael Nemtsev [MVP]
Posts: n/a
Hello pxpilot,

Number of ways, including the xpath to take the parent node ".."
or ParentNode method from XmlNode

Michael Nemtsev [.NET/C# MVP] :: blog:

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

p> Hi,
p> I am trying to retrieve title of the parent (post) by the id of the
p> comment, Why doesn't this work?
p> XML
p> <root>
p> <post>
p> <title>text</title>
p> <comment id='100'>text</comment>
p> <comment id='101'>text</comment>
p> </post>
p> </root>
p> ASP
p> Dim xmlRoot As XmlNode
p> Dim postId as Integer
p> xmlRoot = xmldoc.SelectSingleNode("root")
p> postId = xmlRoot.SelectSingleNode("root/post/
p> comment[@id='101']").SelectSingleNode("title").InnerText
p> Help!

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
UserControl output into an XmlNode Owen Blacker ASP .Net 1 08-16-2005 11:57 AM
Problem in deriving custome class from XmlNode Mahesh Devjibhai Dhola ASP .Net 0 10-15-2004 07:38 AM
Urgent Help Needed Converting from XmlNode to Dataset =?Utf-8?B?TWFl?= ASP .Net 3 09-13-2004 02:28 AM
Re: Can an XmlNode from one XmlDocument be copied to another XmlDocument? Bob ASP .Net 0 07-21-2004 11:49 PM
NullReferenceException...hitting them all today...on XmlNode return Kathy Burke ASP .Net 0 07-24-2003 08:08 PM