472,342 Members | 1,634 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,342 software developers and data experts.

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 1004

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: mono | last post by:
Hello, I have a collection of XML strings and want to find those that match a given XPath expression. I see lots of stuff to support...
2
by: Steve Taylor | last post by:
Is there some reason why I shouldn't be able to use the same XPathExpression simultaneously in multiple iterations? The test below illustrates the...
4
by: gajba | last post by:
Hi, from an XML beginner.. I have an XML like the one below: <root> <vendor name="Microsoft"> <!-- additional sub-tags and items -->...
4
by: viditmittal | last post by:
hi, i have a xml file <root> <Type /> <Description /> <Category /> <employee > <id>3</id>
4
by: Vishy | last post by:
Hi I'm trying to read xml file with namespacemanager; it seems that it adds up a namespace if there is none; How can avoid this? so...
0
by: Philipp Schumann | last post by:
Hi there, don't know whether anyone ran into this issue formerly (in .NET 1.0). I have an XML document with a default namespace (indicating the...
0
by: Martin | last post by:
Hi, I am using xmldocument.selectsinglenode to query an xml document. This works perfectly when the document to be queried has no namespace,...
1
by: Bruce Sandeman | last post by:
Hi, Is anyone able to help me? I have the following code and when I try to create an XPathNavigator object it keeps returning null. any cunning...
2
by: darrel | last post by:
I have an XML file that looks like this: <Counties> <County> <District>2</District> <CountyName>Palm</CountyName> </County> <County>...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.