Re: Svar: Re: [xml] XPath problem with namespaces



On 07.06.2004 23:55, Daniel Veillard wrote:
  You *must* provide the namespace declaration to the prefix used.
Read the example it shows how to bind namespaces to XPath evaluation context !
   http://xmlsoft.org/examples/index.html#xpath1.c

Here is a boog:

  C:\Temp> type testxpath.xml
  <?xml version="1.0"?>
  <ns:doc xmlns:ns="some-ns-uri">
    <ns:node ns:attr="value"/>
  </ns:doc>

  C:\Temp> xmllint --shell testxpath.xml
  / > xpath //ns:node
  XPath error : Undefined namespace prefix
  xmlXPathEval: evaluation failed
  Object is empty (NULL)

Can it be that the xmlShell from debugXML.c doesn't register namespaces for the XPath evaluation context? Whatever it does or doesn't do, it is too late to track it now, I'm off to bed. We'll have a look at it on another day. :-)

Ciao,
Igor



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