Re: [xml] Using Xpath with default namespace and null prefix



On Tue, Feb 09, 2010 at 04:07:06PM +0100, François Delyon wrote:
  /* valid example */
  exsltStrXpathCtxtRegister(ctxt, NULL);
      ...
      
xmlXPathRegisterNs(ctxt, "str", "http://exslt.org/strings";);
xmlXPathEval((const xmlChar *)"str:concat(n)", ctxt);

Now calls <http://www.exslt.org/str/functions/concat/index.html>.

exsltStrXpathCtxtRegister(ctxt, NULL) must occur once when I create
the context.
But the NSregistrations and the Xpath evaluations are up to the
users of my application.

I am not a user of xmlint, but I suppose that the same problem occurs.

  Well xmllint uses only libxml2 and not any of libxslt nor libexslt
xmlXPathRegisterNs is only used if you use the --shell option and use
setns command to registed a namespace for XPath evaluation.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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