W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2002

XPathResult singleNodeValue

From: Elliotte Rusty Harold <elharo@metalab.unc.edu>
Date: Fri, 15 Feb 2002 14:15:37 -0500
Message-ID: <3C6D5E59.7030102@metalab.unc.edu>
To: www-dom@w3.org
The singleNodeValue attribute in XPathResult bothers me.

readonly attribute Node singleNodeValue <http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-singleNodeValue>;


I'm afraid that this is going to encourage developers to assume that 
there's exactly one result when in fact that may not be true. I think 
I'd prefer this attribute to return either NodeList or some custom 
XPathNodeSet interface and put all the iteration methods in that 
interface, rather than directly in XPathResult. e.g.

readonly attribute NodeList nodeSetValue <http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult-singleNodeValue>;


This model just feels to me to be a lot closer to what XPath 1.0 
actually states. For myself, I noticed that I didn't really understand 
XPath until  learned to stop thinking in terms of single nodes and start 
thinking in terms of node sets.

--
Elliotte Rusty Harold
Received on Friday, 15 February 2002 14:15:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:55 GMT