You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Varuna Jayasiri <vp...@gmail.com> on 2008/07/13 08:57:29 UTC

[GSoC] XPath namespaces

I need to clarify somethings about how namespaces are handled in XPath. I
tried searching through tutorials and specifications but still have a few
doubts.

Can you please let me know how expressions such as *** are and *ns:** are
handled when there are namespaces in the XML.

e.g.
*XML*
<ns1:node xmlns:ns1="test">abc</ns1:node>
<node>abc</node>

XPath  1
*

*should this select node* with namespace

XPath 2
ns:*

should this select node without namespace


Please also advise me if there's anything I'm missing out here

Thank you

-- 
Varuna
www.xvpj.net

Re: [GSoC] XPath namespaces

Posted by Dumindu Pallewela <pa...@gmail.com>.
Hi Varuna,

Please find my comments inline.

On Sun, Jul 13, 2008 at 12:27 PM, Varuna Jayasiri <vp...@gmail.com>
wrote:

> I need to clarify somethings about how namespaces are handled in XPath. I
> tried searching through tutorials and specifications but still have a few
> doubts.
>
> Can you please let me know how expressions such as *** are and *ns:** are
> handled when there are namespaces in the XML.
>
> e.g.
> *XML*
> <ns1:node xmlns:ns1="test">abc</ns1:node>
> <node>abc</node>
>
> XPath  1
> *


> *should this select node* with namespace


(Assuming that you meant to say "//*")
Yes it should.


>
>
> XPath 2
> ns:*
>
> should this select node without namespace
>

(assuming "//ns:*")
No.

However, if you are selecting a particular node, it should behave in a
different manner. For examples:

"//node" should result in only the second node and "//ns:node" should result
in only the first node.

HTH,
Dumindu.

-- 
Dumindu Pallewela
Cinergix - "Share, Reuse, Innovate"
cinergix.com