Re: [xml] Re: XPath evaluation and namespace prefixes



On Thu, Mar 04, 2004 at 05:45:17PM -0500, Kei wrote:
Hello,

I have a rookie question on this regard.

Let's say I have this xml document.

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog xmlns="www.mycoolcdcollection.com">
 <cd>
  <title>Empire Burlesque</title>
  <artist>Bob Dylan</artist>
 </cd>
 <cd>
  <title>Hide your heart</title>
  <artist>Bonnie Tyler</artist>
 </cd>
</catalog>

I'm trying to do XPath to find all the title nodes.
My XPath expression is simply "//title", and it fails to find any node.

If I remove the default xml namspace declaration in <catalog>, it works
fine.

  That's normal, that's how the XPath spec is designed.
    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]