Hi
Have created an xml document with an xmltextwriter with a namespace, so it
can be validated against an xsd schema.
Later in my application, I want to extract values from the xml and am using
xpathexpression.
Because I have a namespace in the xml, I have to use the xmlNameSpaceManager
and comile an xpathquery as below:
objXMLXPathNav = objXMLXPathDocument.CreateNavigator()
'//Add namespace manager
'Dim objExpr As XPathExpression =
objXMLXPathNav.Compile("ns1:root/ns1:element1")
'Dim objNamespaces As XmlNamespaceManager = New
XmlNamespaceManager(New NameTable)
'objNamespaces.AddNamespace("ns1",
"http://tempuri.org/myXSD.xsd")
'objExpr.SetContext(objNamespaces)
Dim objXPathNodeIterator As XPathNodeIterator = objXMLXPathNav.Select(objExpr)
While (objXPathNodeIterator.MoveNext())
intValue = CInt(objXPathNodeIterator.Current.Value())
End While
This works fine for finding one node, but I want to match a further 6
different nodes, which are above and below the first node I select
I can't find any examples where multiple xpathexpressions are used.
Do I have to re-create the whole process to create a new xpathexpression
every time, or is there an easier way?
Thanks