469,568 Members | 1,373 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,568 developers. It's quick & easy.

Multiple xpathexpression with Namespacemanager

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
Nov 17 '05 #1
0 934

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by mono | last post: by
2 posts views Thread by Steve Taylor | last post: by
4 posts views Thread by gajba | last post: by
4 posts views Thread by viditmittal | last post: by
reply views Thread by Philipp Schumann | last post: by
reply views Thread by Martin | last post: by
1 post views Thread by Bruce Sandeman | last post: by
2 posts views Thread by darrel | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.