Re: [xml] xmllint --shell : xpath is not working? (libxml2-2.6.4)

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 ""; 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)


So does it mean, we need another shell command like e.g.
  bind ns_prefix,ns_url
which would call

  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
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]