Hey,
As with most things XML related, there are multiple ways to skin a cat.
Here is another way of getting the information that you need:
Here, I am only get a reference to the parent node, in this case "job" then navigating the navigator to get the information that is one level down from it.Code:Dim xpathDoc As XPathDocument = New XPathDocument(Server.MapPath("XmlFile1.xml")) Dim navigator As XPathNavigator = xpathDoc.CreateNavigator() Dim expression As XPathExpression = navigator.Compile("/jobCodes/job[RoomID['1']][ComponentID['2']]") Dim nodeIterator As XPathNodeIterator = navigator.Select(expression) While nodeIterator.MoveNext() Dim clone As XPathNavigator = nodeIterator.Current.Clone() clone.MoveToChild("DUIJobDescription", String.Empty) Dim duiDescription As String = clone.Value clone.MoveToParent() clone.MoveToChild("SoRCode", String.Empty) Dim sorCode As String = clone.Value Response.Write(String.Format("DUIDescription: {0}, SorCode: {1}", duiDescription, sorCode)) End While
Gary





Reply With Quote