Link to home
Start Free TrialLog in
Avatar of zerogeek
zerogeekFlag for United States of America

asked on

Parse XML in VB .NET 2003 <result id="example">

The function in the attached code works great if I have an xml as shown on the top. However, I do not know how to read the bottom xml. Anyone want to help me out on this?
<xml>
  <area>
    <test>
      <result> Example </result>
    </test>
  </area>
</xml>
 
 
Public Fuction ReadXML()     
   Dim xml As Object
        Dim XMLDoc As New XmlDocument
        Dim nodeList As XmlNodeList
        ' Dim node As XmlNode
 
        XMLDoc.Load("C:\temp\example.xml")
 
        nodeList = XMLDoc.SelectNodes("area/test/result")
        For Each node As XmlNode In nodeList
            Dim lsted As String = node.InnerText
            lblisted.Items.Add(lsted)
        Next
End Function
 
 
<xml>
  <area>
    <test>
      <result id="example" hid="example2" other="example3">
    </test>
  </area>
</xml>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
jinal,

If you are going to make use of suggestions made by other experts, please be courteuos enough to acknowledge them.

Wayne
Hello Wayne,
When i posted my code i did not read the comment by other expert.
I realize that partial part of my code already there.  I will take care of this next time.
Thanks.
Avatar of zerogeek

ASKER

Thank you. Both answers were great.