W3C home > Mailing lists > Public > public-webapi@w3.org > February 2006

Namespaces in Xpath expressions

From: Elliotte Harold <elharo@metalab.unc.edu>
Date: Thu, 09 Feb 2006 11:26:37 -0500
Message-ID: <43EB6D3D.7000302@metalab.unc.edu>
To: public-webapi@w3.org

I haven;t finished reading the spec yet, so I may be jumping the gun 
here but I believe the XPath expression used in the REX document are 
incorrect. Specifically they do not use namespace prefixes. Consider 
this example.

<rex xmlns='http://www.w3.org/2006/rex'>
   <event target='/html/body/table[2]' name='DOMNodeInserted' position='7'>
     <tr xmlns='http://www.w3.org/1999/xhtml'>
       <td>Rover</td>
       <td>Alpine Labrador</td>
       <td class='food'>bone</td>
     </tr>
   </event>
</rex>


If this refers to an XHTML document it should look something like this:


<rex xmlns='http://www.w3.org/2006/rex' 
xmlns:html='http://www.w3.org/1999/xhtml'>
   <event target='/html:html/html:body/html:table[2]' 
name='DOMNodeInserted' position='7'>
     <tr xmlns='http://www.w3.org/1999/xhtml'>
       <td>Rover</td>
       <td>Alpine Labrador</td>
       <td class='food'>bone</td>
     </tr>
   </event>
</rex>

The same issue applies in the SVG example. As written I don't think 
these XPath expressions will find anything.


-- 
´╗┐Elliotte Rusty Harold  elharo@metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim
Received on Thursday, 9 February 2006 16:26:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:53 GMT