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



Hi Daniel,

sorry for the too short desription,

Daniel Veillard wrote:
On Fri, Jan 23, 2004 at 10:42:43AM +0100, Stefan Kost wrote:

hi hi,

can anyone confirm and/or explain that?


  Confirm taht it is actually working,


xmllint --shell giml/gitkTemplate_message.xml

<giml xmlns="http://gitk.sourceforge.net/";

[...]

     <widget id="Message" type="label"/>

[...]

/ > xpath //widget
Object is a Node Set :
Set contains 0 nodes:
/ >


  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:

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)
Daniel

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))
- or is there another way to handle it?
If not, should prepare a patch?

Ciao
  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]