Hi all, what is the best way to navigate through an XML file? The structure of the XML is...
I am loading and reading the document using....
As you may see this line works, but with limitations...
The problem here is I retrieve all the values of all child nodes.... I don't want the ID numbers "aid" , only the "word" values.
I have
but that didn't work.
Thanks in advance.
VB.NET:
<?xml version="1.0" standalone="yes" ?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<words>[INDENT]<aid>1</aid>
<word>one</word>
[/INDENT]</words>
<words>[INDENT]<aid>2</aid>
<word>two</word>
[/INDENT]</words>
<words>[INDENT]<aid>3</aid>
<word>three</word>
[/INDENT]</words>
<words>[INDENT]<aid>4</aid>
<word>four</word>
[/INDENT]</words>
<words>[INDENT]<aid>5</aid>
<word>five</word>
[/INDENT]</words>
</root>
I am loading and reading the document using....
VB.NET:
Dim xmlDocPath As String = MapPath("Words.xml")
Dim xmlReader As XmlTextReader = New XmlTextReader(xmlDocPath)
While (xmlReader.Read())
If xmlReader.NodeType = XmlNodeType.Text Then
alWordList.Add(xmlReader.Value)
Trace.Write("Added: " & xmlReader.Value)
End If
End While
xmlReader.Close()
As you may see this line works, but with limitations...
VB.NET:
If xmlReader.NodeType = XmlNodeType.Text Then
The problem here is I retrieve all the values of all child nodes.... I don't want the ID numbers "aid" , only the "word" values.
I have
VB.NET:
tried xmlReader.Name = "word"
Thanks in advance.