Svar: Re: [xml] XPath problem with namespaces



No, it doesn't work. About the only _expression_ I can get to work is something like //*. This will return the Envelope (as expected) node as the first node in the result. The namespace for this node is SOAP-ENV (also as expected).
 
It probabely shouldn't matter but I'm using the Pascal port of LibXML2.
 
- Erik

>>> Igor Zlatkovic<igor zlatkovic com> 07-06-2004 20:14:03 >>>
On 07.06.2004 19:06, Erik F. Andersen wrote:
> Hi!
>
> I'm trying to get an understanding of XPath and are having problems getting things to work. I have basically been looking everywhere for an example of how to use namespaces with XPath and XMLLib2 without much success. My XML looks (something) like this:
>
> <?xml version="1.0"?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:SOAPENC="http://schemas.xmlsoap.org/soap/encoding/">
> <SOAP-ENV:Body
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> wsu:Id="Id-59ef0d9b-1ac6-4fff-85cb-3f52ec95c47c"
> xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">
> <NS1:GetFormularArray xmlns:NS1="urn:AesSoapServiceIntf-IAesSoapService">
>
> All I want to do now is to select the SOAP-ENV:Body element but I haven't been able to figure out how to to this yet! Can anyone please tell me what the correct syntax for XPath is to do this?

in your document it is

   /SOAP-ENV:envelope/SOAP-ENV:body

or a somwhat slower variant

   //SOAP-ENV:body

Doesn't that work?

Ciao,
Igor


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]