Re: [dom-xpath] XPath or? (was RE: Announcing www-dom-xpath@w3.org)

At 03:31 PM 5/2/00 -0400, Scott Boag/CAM/Lotus wrote:

>Because when it's time to do a real query API, this may well confuse
>matters.  It's better to not do an API, rather than do an API completely
>wrong.  (I'm actually not taking a position on this yet... just asking the
>question.)

Well, it is true that the Query WG has released only it's requirements 
document, and it's not completely clear what the API for Query should look 
like. On the other hands, we do know, from the requirements, that a query 
will be able to return at least one of the following: DOM Nodes or 
Iterators or TreeWalkers. Here's a quote from the requirements:

DOM

The XML Query Language must be able to return results in a form that can be 
used in DOM programs, such as DOM Nodes or the Iterators and TreeWalkers 
defined in the Traversal specification (W3C members only).

I would suggest that we coordinate the effort here with the Query WG. I'm 
on that WG, and I'd be glad to serve as a go-between.

>How about something like the following?

[SNIP!]

There's a lot of good stuff here. I agree that the method should not be 
defined on Node. A few issues:

1. Input.  I think that the context of a query should be able to be a Node 
or a NodeList, and should be able to use nodes from multiple documents.

2. Return type. We can't assume that every query returns a NodeList, but I 
think that it's reasonable to assume that the person who issues a query 
knows what it returns, and can call the function with the proper return 
type. If not, raise an exception.

3. Query Objects. You are right, the ability to create a query object 
allows a query to be built and optimized, then reused many times. Many 
queries, of course, are one-offs, so it's not clear to me that a Query 
Object is *always* needed. I think that having methods that take query 
strings as arguments is a Good Thing, and is probably the more common case, 
but Query Objects are also good. I'd probably like to see both.

>My big point is, I don't think that all new API in the W3C should become
>part of the DOM.  There is also the matter of the XML Transformation API
>(please see http://trax.openxml.org/), which maybe should become a W3C API,
>but should not a DOM API.  Also, remember that XPath can call extensions,
>so now you need an Extensions API.  Then there's the little matter of
>Schemas.  Etc.  The DOM Pandora's Box should be closed, and the W3C should
>be thinking in terms of modules.  I would also like to see some of these
>APIs include SAX stuff.

There's an important coordination issue here - perhaps the API should 
belong to the Query WG eventually, perhaps to the DOM WG....I'm not sure 
where this fits best. I'd like to see it somewhere in the W3C.

Jonathan

Received on Tuesday, 2 May 2000 15:49:31 UTC