Re: [xml] Default namespaces with XPath



On Wed, Dec 25, 2002 at 01:42:40PM +0530, Ganesh Sivaraman wrote:
Hi,
   I'm still learning the ropes with XML. I understand I can use XPath to access particular nodes in the 
DOM tree.
I have a xml doc. with default namespaces as below:
[...]
What am I doing wrong and how do I use XPath with default namespaces?

  You cannot, it's a restriction of the XPath specification !
You have to define a prefix for the namespace, register it with
xmlXPathRegisterNs() and use that prefix in the XPath expression.
There is no way around this, this is defined in the XPath spec
  http://www.w3.org/TR/xpath#node-tests


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]