[resolved] [2005] how to select parentnode in xml with certain id
Hi, I have the following xml doc:
Code:
<?xml version="1.0" encoding="utf-8"?>
<books>
<book id="1">
<title>book1title</title>
<text>book1text</text>
</book>
<book id="2">
<title>book2title</title>
<text>book2text</text>
</book>
</books>
I was wondering how it's possible to select say book with id 2, so that later I could use that book's title and text. I am just trying to figure this out so that later I could use something like MsgBox(Book.Title)...
Any suggestions?
Re: [2005] how to select parentnode in xml with certan id
Ok i figure out how to get Parent Node, now if only I could get Child Node of "text"... :(
This is what I have so far:
VB Code:
Dim xmldoc2 As New XmlDocument
xmldoc2.Load(Application.StartupPath & "\books.xml")
Dim Node As Xml.XmlNode = xmldoc2.DocumentElement.SelectSingleNode( _
"book[@id=" & Chr(34) & "2" & Chr(34) & "]")
If Not Node Is Nothing Then
' Need to msgbox the value inside <text>
End If
Re: [2005] how to select parentnode in xml with certan id
ok i got that part too:
VB Code:
MsgBox(Node.Item("text").InnerText)
team work! :rolleyes: