Subject: RE: XPath and root-less namespace problem
From: "Ken Shino" <kenji@xxxxxxxxxxx>
Date: Thu, 15 May 2003 16:23:50 -0400
|
My question never originally got answered, so I'll ask it again:
> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema" name="IZPOP3service"
> targetNamespace="http://www.zanetti-dev.com/"
> xmlns:tns="http://www.zanetti-dev.com/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
> xmlns:ns1="http://www.zanetti-dev.com/XMLSchema"
> xmlns:ns2="http://www.borland.com/namespaces/Types">
> <service name="IZPOP3service">
> <port name="IZPOP3Port" binding="tns:IZPOP3binding">
> <soap:address
> location="http://www.zanetti-dev.com/scripts/zpop3ws.exe/soap/
> IZPOP3"/>
> </port>
> </service>
> </definitions>
>
> My XPath of:
>
> //definitions/service/port[@name='IZPOP3service']/*/@location
>
> returns nothing.
>
> However, if I remove the
> "xmlns='http://schemas.xmlsoap.org/wsdl'" from my
> code, it works BEAUTIFULLY. I can fully traverse this file,
> and can do any
> XPath I want to. But that's not the right way to do this.
See <http://www.w3.org/TR/xpath#node-tests>
"--except that the default namespace declared with xmlns is not used--"
Thus
//x:definitions/x:service/x:port[@name='IZPOP3service']/*/@location
with ns-prefix x bound to URL http://schemas.xmlsoap.org/wsdl/ will work.
Cheers,
Jarno - Delerium: Heavens Earth
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
------
Great. How do I do this programmatically in Java?
-- Kenji
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
Jarno . Elovirta - Thu, 15 May 2003 02:34:00 -0400 (EDT)
- Ken Shino - Thu, 15 May 2003 02:56:34 -0400 (EDT)
- Ken Shino - Thu, 15 May 2003 15:26:36 -0400 (EDT) <=
- Michael Kay - Thu, 15 May 2003 16:28:25 -0400 (EDT)
- Ken Shino - Thu, 15 May 2003 21:10:37 -0400 (EDT)
|
|