Re: [xml] XPath question
- From: Igor Zlatkovic <igor zlatkovic com>
- To: Ed Day <eday obj-sys com>
- Cc: xml gnome org
- Subject: Re: [xml] XPath question
- Date: Mon, 10 May 2004 18:22:13 +0200
On 10.05.2004 18:09, Ed Day wrote:
I am relatively new to XPath, so perhaps there is something I don't
understand here. I am using the following XPath expression:
to try and match the following simple node:
This is coming back as a non-match. Apparently something in the namespace
declaration is causing this. If I remove that, or replace it with an
attribute of a different name, the match is done OK. The question is, if
information on the namespace is required in the expression, what should it
be? Since it is the default namespace, it does not have a prefix. So I
don't know how to get this to match.
I am using the latest version of libxml2, but I am not sure this is a
libxml2 problem. I got the same result when I used a different XPath tool.
I am hoping some XPath guru out there can tell me what I am doing wrong.
Consider this document:
Now assume that those 'n' nodes inherit the default namespace from their
parents. How would you construct an XPath expression which selects any
one of the two 'n' nodes, but not the other?
To skip the boresome details, you cannot do what you are trying to. You
must give your namespace a prefix and include that prefix in your XPath
] [Thread Prev