Read all nodes and elements in XML (

Total Post:29


 9306  View(s)
Rate this:
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
For Each node As XmlNode In xml.DocumentElement.SelectNodes("*")

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. 
  1. Re: Read all nodes and elements in XML (

    Hi Andrew,

    You can try as following

    Dim xml As New Xml.XmlTextReader(sFilePath)

    While xml.Read
        If xml.NodeType = Xml.XmlNodeType.Element Then 
        End If
    End While

    I hope it resolve your problem. 

  1. Re: Read all nodes and elements in XML (

    Hope this will help you....



Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.