forum

Home / DeveloperSection / Forums / Read all nodes and elements in XML (VB.net)

Read all nodes and elements in XML (VB.net)

Andrew Deniel1073911-Jun-2013
Hi Expert,

I'm trying to read an xml file, there is no problem to doing this

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.

Thanks in advance. 

Updated on 18-Apr-2019

Can you answer this question?


Answer

2 Answers

Liked By