473,231 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

XPath with prefix and local name

The following returns a system error of System.Xml.XPath.XPathException.

Dim Nodes As XmlNodeList
Nodes = doc.SelectNodes("soap:Body")

How is the XPath string formed where there is a prefix and a local name for
the node?

Nov 12 '05 #1
2 5190

Tom_B wrote:
The following returns a system error of System.Xml.XPath.XPathException.

Dim Nodes As XmlNodeList
Nodes = doc.SelectNodes("soap:Body")

You need to use an XmlNamespaceManager, bind that prefix to a namespace
URI and pass the namespace manager as the second argument to SelectNodes.
VB pseudo code
Dim NamespaceManager as System.Xml.XmlNamespaceManager
NamespaceManager = New System.Xml.XmlNamespaceManager(doc.NameTable)
NamespaceManager.AddNamespace("soap", "putURIHere")
doc.SelectNodes("soap:Body", NamespaceManager)
Which URI you need depends on the input XML of course.


Martin Honnen --- MVP XML
Nov 12 '05 #2
That works -- Thanks.
Nov 12 '05 #3

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

Similar topics

by: FaensenD | last post by:
Consider the following XML document <root> <PersonStreet>24 Miller Street</PersonStreet> <PersonZIP>12345</PersonZIP> <PersonCity>Munich</PersonCity> <CompanyStreet>24 Miller...
by: ree32 | last post by:
When I import an xml document in Visual studio and Genereate as schema from it, and create a dataset from it, it adds this line into to the root element of my xml file -...
by: Echo 8 | last post by:
Is there a simple way of compare dates? I am trying to create a list of perishable stock in an inventory that is near or past its expiration date. I've tried telling it to compare a node's value...
by: David Thielen | last post by:
Hi; I set up my xml as follows: XmlDocument xml = new XmlDocument(); xml.Load(File.Open("data.xml", FileMode.Open, FileAccess.Read)); XmlNamespaceManager context = new...
by: Shawn | last post by:
Hi. I have an XML file that looks like this: <?xml version="1.0" encoding="utf-16"?> <Transfer> <Config xmlns="http://www.mysite.com/Transfer/"> <site>NY</site> </Config> </Transfer> I'm...
by: Paul | last post by:
I'd like to write an XPath expression that gets all nodes with a given local-name, say 'Customer', within a given namespace. From a prior response I got the following to get nodes with a specific...
by: Monty | last post by:
Despite reading posts in Google, I don't understand XPATH. Can someone help me write an XPATH. From Google I think my problem is that the default namespace does not have a prefix. I can't change...
by: sobczyk.wojciech | last post by:
I have XML: <xml xmlns="http://abc"> <A t="ttt"></A> <B xmlns="http://qwerty"><X>aaaa</X></B> </xml> How to point node "B" with XPath without any changes in this xml?
by: gimme_this_gimme_that | last post by:
This may be so easy no one responds. What is the XPath expression that fetches the value PPV - the PersistentTicket? The namespace thing is throwing me off. Thanks. <?xml version="1.0"...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.