Re: [xml] XPath and namespaces



On Thu, Apr 01, 2004 at 06:20:51PM +0200, Petr Novak wrote:
I read at http://mail.gnome.org/archives/xml/2002-December/msg00186.html
that it can be solbed by xmlXPathRegisterNs(). So I tried

  xmlXPathRegisterNs(context, NULL, "http://www.liberouter.org";);
or
  xmlXPathRegisterNs(context, "", "http://www.liberouter.org";);

(because I don't use prefix), bud it still not works. What am I doing
wrong?

  Because as XPath is specified the name foo will *never* match 
an element (or attribute) named foo in a namespace. Read the XPath
spec that's defined there, I pointed it in the list at least a dozen
time already I'm sure. You must set a prefix in the XPath and register
the prefix.

Daniel

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