Reputation: 2177
I'm trying to read an xml file, and that's usually no problems.
But, in this case I will not know anything about this xml file, i just want to read everything, including all child nodes and get the name and value from each node.
This code gives me only the name of the first node and skips all children:
Dim xml As New XmlDocument
xml.Load(myxml.xml)
For Each node As XmlNode In xml.DocumentElement.SelectNodes("*")
MsgBox(node.Name)
Next
since i don't know dept or anything, i don't know how i will do this. And every solution i find is based by knowing element names.
Upvotes: 2
Views: 21869
Reputation: 9888
Another option:
Dim xml As New Xml.XmlTextReader(sFilePath)
While xml.Read
If xml.NodeType = Xml.XmlNodeType.Element Then
MessageBox.Show(xml.Name)
End If
End While
Upvotes: 4