XPathResult singleNodeValue

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 UTC