I am new to xml navigation in .NET so I have a fairly basic question I hope someone can help me with.
I have a xml file with a similar structure as shown below. I iterate through the node list and find the node I need based on field1. However I am not sure how I can reach the value I need which is field2.
Maybe it is a better approach to set the navigator to ""/message/value" and then retreive each child individually. If so any advise of the syntax will be very good.
<?xml version="1.0" encoding="iso-8859-1"?>
<field2>This is the text I need for 0001</field2>
<field2>This is the text I need for 0002</field2>
Dim xpathDoc As XPathDocument
Dim xmlNav As XPathNavigator
Dim xmlNI As XPathNodeIterator
Dim _strValue As String = ""
xpathDoc = New XPathDocument("C:\test.xml")
xmlNav = xpathDoc.CreateNavigator()
xmlNI = xmlNav.Select("/message/value/field1")
If xmlNI.Current.Value = "0001" Then
_strValue= some code here to retrieve value "This is the text I need 0001"