Re: [xml] xmllint --shell : xpath is not working? (libxml2-2.6.4)
- From: Daniel Veillard <veillard redhat com>
- To: Stefan Kost <kost imn htwk-leipzig de>
- Cc: xml gnome org
- Subject: Re: [xml] xmllint --shell : xpath is not working? (libxml2-2.6.4)
- Date: Mon, 26 Jan 2004 05:27:26 -0500
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...
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
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]