W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: XPath and find/findAll methods

From: Robin Berjon <robin@berjon.com>
Date: Tue, 29 Nov 2011 17:34:52 +0100
Cc: liam@w3.org, public-webapps@w3.org
Message-Id: <031295F0-350E-48C6-93BC-8A3E193D0315@berjon.com>
To: Henri Sivonen <hsivonen@iki.fi>
On Nov 29, 2011, at 17:09 , Henri Sivonen wrote:
>>    /html/body/div/p[@id = /html/head/link[@rel = 'me']/@src]/strong
> 
> This example depends on unprefixed name expressions matching the
> (X)HTML namespace when tested against an element and no namespace when
> tested against attributes. And that trick only works with (X)HTML
> nodes.
> 
> Selectors have the advantage that they wildcard the namespace by
> default, so it's feasible to define APIs that don't even have
> namespace binding mechanisms.

That's a candidate for fixing or, as Anne put it, "DOM4-ification". If you look at Opera's implementation, you see:

>>> document.selectSingleNode("//p").namespaceURI
"http://www.w3.org/1999/xhtml"

and

>>> document.selectSingleNode("//html:p", function () { return "http://www.w3.org/1999/xhtml"; }).namespaceURI
"http://www.w3.org/1999/xhtml"

I'm not sure that it would break much existing content  would be useful to look further though.

-- 
Robin Berjon - http://berjon.com/ - @robinberjon
Received on Tuesday, 29 November 2011 16:35:17 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:49 GMT