W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2002

Re: XPath DOM and XPath 2.0

From: Curt Arnold <carnold@houston.rr.com>
Date: Tue, 2 Apr 2002 18:58:52 -0600
Message-ID: <001501c1daaa$b8eefc90$a800a8c0@CurtMicron>
To: <www-dom@w3.org>
Philippe Le Hegaret wrote:
> One solution would be to request the type in the XPath expression
> itself:
> evaluate(".//h1") returns
>  XPathResult.XPathSequenceResult

I don't have any problems with pushing any type coersion operations up into
the XPath query itself.  I think I suggested it myself a few times, just
didn't remember it this time.

> evaluate(".//h1[1]") returns
>  XPathResult.XPathSingletonResult(nodeValue)

I'm not sure about this, You would not want the result type changing based
on the number of nodes that matched a query and this is just a special case
of a query that never matches more than one node.  I think you've got to
flag that you want only a node and not a sequence outside of the query.

> Agree with the approach of valueTypeNamespaceURI/valueTypeLocalName.
> However, I still note that this solution forces the implementation to
> encapsulate the Nodes into XPathResult objects in case of a node set.

Yep.  To do otherwise, I'd think you'd have to have one pair of
snapshotItem/iterateNext for nodes and one for atomic values.
Received on Tuesday, 2 April 2002 19:59:10 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:10 UTC