Re: Document Object Model (DOM) Level 3 XPath Specification

Christian Nentwich wrote:
> My requirements are such that I don't know the return type of evaluating an
> XPath expression in advance. I can't choose between evaluateAs* beforehand.
> 

> I would find it much preferable to get a result object. Such a result object
> could indicate its type and be able to return its value as a string, nodeset,
> etc. I would also stress (even though there is some reference to this in the
> document), that it would be vital to be able to pass an evaluation context to
> the functions (i.e. containing variables and so on).

We thought about a result object but it creates an indirection since you need
to get the result object and then the result value. Based on the assumption
that most of the apllications will know the result type before invoking the
methods, we didn't change the current proposal. But, in order to address your
use case, the current approach is to add a new method that returned the type of
the XPath expression.
 
> I have further requirements that require the repeated evaluation of XPaths
> (>= 100000 times). I find the Xalan approach quite useful here, which parses
> the path once to be evaluated multiple times. I see quite a bad performance
> hit coming along if I use the interfaces from the draft (which take a string
> rather than a parsed path object.

Unfortunately, we didn't find enough interest across the current DOM
implementations to add this functionality in the API. The current approach is
not meant to cover all the use cases but to provide a simple approach [1].
IMHO, a complete version of a Query API could be addressed in the future based
on the work of the XML Query WG.

Philippe

[1] http://www.w3.org/TR/2001/WD-DOM-Requirements-20010419/#level3-xpath

Received on Thursday, 21 June 2001 17:34:54 UTC