Xpath Expression and Iterations
-
hi iam new to the Xpath could anyone help me?? i just want to pick up countryname which is element and it has a attribute for the code. i want to pick these values from the XmlDoc the code here as follows:- Dim CountryPropExpr As XPath.XPathExpression = Nav.Compile("./CountryName[@Code=""]") Dim CountryPropIter As XPath.XPathNodeIterator = Nav.Select(CountryPropExpr) If CountryPropIter IsNot Nothing AndAlso CountryPropIter.Count > 0 Then Try Dim CountryNameCode As String = getNodeValue(CountryPropIter.Current.SelectSingleNode("./CountryName[@Code=""]")) For Each CountryNameCode In CountryPropIter CountryNameCode = CountryPropIter.Current.Value Next Builder.AppendLine("") Catch ex As Exception Debug.Write(ex.Message) End Try End If when i compile it didn't pickup the values. Thanks Heaps in Advance
-
hi iam new to the Xpath could anyone help me?? i just want to pick up countryname which is element and it has a attribute for the code. i want to pick these values from the XmlDoc the code here as follows:- Dim CountryPropExpr As XPath.XPathExpression = Nav.Compile("./CountryName[@Code=""]") Dim CountryPropIter As XPath.XPathNodeIterator = Nav.Select(CountryPropExpr) If CountryPropIter IsNot Nothing AndAlso CountryPropIter.Count > 0 Then Try Dim CountryNameCode As String = getNodeValue(CountryPropIter.Current.SelectSingleNode("./CountryName[@Code=""]")) For Each CountryNameCode In CountryPropIter CountryNameCode = CountryPropIter.Current.Value Next Builder.AppendLine("") Catch ex As Exception Debug.Write(ex.Message) End Try End If when i compile it didn't pickup the values. Thanks Heaps in Advance
Please provide a document fragment. Without the XML, there is noway to test the validity of your method call.
"In quiet and silence, the truth is made clear."