Re: [xml] xmllint --shell : xpath is not working? (libxml2-2.6.4)
- From: Stefan Kost <kost imn htwk-leipzig de>
- To: veillard redhat com
- Cc: xml gnome org
- Subject: Re: [xml] xmllint --shell : xpath is not working? (libxml2-2.6.4)
- Date: Tue, 27 Jan 2004 13:26:00 +0100
hi Daniel,
Daniel Veillard wrote:
On Mon, Jan 26, 2004 at 11:06:07AM +0100, Stefan Kost wrote:
it's an XPath FAQ, a non qualified name do not select namespaced nodes.
And widget is in the "http://gitk.sourceforge.net/" namespace.
You can try xpath //*[localname = 'widget'] to confirm this.
/ > xpath //*[localname = 'widget']
Object is a Node Set :
Set contains 0 nodes:
that would be localname(), it's a function call...
just for the mailing-list archive - the corrent name is 'local-name()'
xpath //*[local-name() = 'widget']
Object is a Node Set :
Set contains 1 nodes:
1 ELEMENT widget
ATTRIBUTE id
TEXT
content=Message
ATTRIBUTE type
TEXT
content=label
XPath wasn't designed to be used in isolation, the specifications
embedding it have to provide the mechanism to bind namespaces,
then something like //gimp:widget would work.
I've already tried that (but excluded it form the post)
/ > xpath //giml:widget
XPath error : Undefined namespace prefix
xmlXPathEval: evaluation failed
Object is empty (NULL)
normal.
So does it mean, we need another shell command like e.g.
bind ns_prefix,ns_url
which would call
xmlXPathRegisterNs(ctxt,GITK_NS_PREFIX,GITK_NS_URL))
yes, that's the proper way.
- or is there another way to handle it?
not really, even inheriting from the namespaces at the current
node in the document would not help in a lot of cases, especially
default namespaces.
If not, should prepare a patch?
yes if you can. See xmlShell() in debugXML.c
Its on my TODO list ;-)
Stefan
--
\|/ Stefan Kost
<@ @> private business
+-oOO-(_)-OOo------------------------------------------------------ - - - - -
| __ Address Simildenstr. 5 HTWK Leipzig, Fb IMN, Postfach 301166
| /// 04277 Leipzig 04251 Leipzig
| __ /// Germany Germany
| \\\/// Phone +49341 2253538 +49341 30766101
| \__/ EMail st_kost_at_gmx.net kost_at_imn.htwk-leipzig.de
| WWW www.sonicpulse.de www.imn.htwk-leipzig.de/~kost/about.html
===-=-=--=---=---------------------------------- - - - - -
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]