DaneBigham
asked on
Parsing XML in VB.Net
I'm attempting to parse an XML document (see attachment) in VB.Net. Unfortunately, I'm having trouble identifying the nodes for which I'd like to parse elements. Here's my current code:
However, the code within the 'For Each' was bypassed. I also tried "/EmployeeResponse/Employe es/Employe e") to SelectNodes, but got the same result.
Any help is greatly appreciated.XMLSample.xml
Dim xmlDoc As New XmlDocument
xmlDoc.Load("c:\temp\XMLSample.xml")
Dim nodes As XmlNodeList = xmlDoc.DocumentElement.SelectNodes("/Employees/Employee")
Dim strField1 As String = "", strField2 As String = "", strField3 As String = ""
For Each node As XmlNode In nodes
strField1 = node.SelectSingleNode("FirstName").InnerText
strField2 = node.SelectSingleNode("LastName").InnerText
strField3 = node.SelectSingleNode("Address").InnerText
Next
However, the code within the 'For Each' was bypassed. I also tried "/EmployeeResponse/Employe
Any help is greatly appreciated.XMLSample.xml
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Fernando