Re: New DOM Level 2 Working Draft

Stephen R. Savitzky wrote:

 > Congratulations!  After seeing the previous version I was very worried about
 > NodeIterator and TreeWalker; the present implementation definitely does the
 > right thing, defining them exactly the way an implementor would expect.

Thanks - I was kind of wondering what you would think, since we received a 
great deal of feedback from you earlier on. The current draft has benefited 
greatly from the time and attention that Joe Kesselman and Andy Heninger 
gave to it.

 >2. There doesn't seem to be any way to create an Iterator from a NodeList or
 >   NamedNodeMap.  In this regard it is also unfortunate that NamedNodeMap is
 >   not an extension of NodeList.

This is a valid critique, and I expect that there will be DOM 
implementations that *will* create Iterators from NodeLists or 
NamedNodeMaps, or that return collections of Iterators as results of queries.

 >3. Ideally, all methods that return NodeList should be deprecated and
 >   replaced by methods that return an equivalent Iterator.
 >
 >4. A Document should be able to import a TreeWalker.

That would require a decision to put Iterator in the core. Iterator is part 
of an optional module, and the core can not have dependencies on optional 
modules. I think these are reasonable suggestions, but these aren't things 
that could easily happen for Level 2 (as you say yourself later on in your 
message).

 >5. The semantics of nextSibling on TreeWalker are unclear if the next
 >   sibling exists but does not match the filter criteria.

Here is the text as stands:

nextSibling
	Moves the TreeWalker to the next sibling of the current node, and returns
	the new node. If the current node has no next sibling, returns null, and 
retains
	the current node.
Return Value
	Node		The new node, or null if the current node has no next sibling.
No Parameters
No Exceptions

To make it clearer, perhaps I should change the text "If the current node 
has no next sibling, returns null, and retains
the current node" to read "If the current node has no next sibling in the 
logical view, returns null, and retains
the current node". Would that wording do the trick? I could make parallel 
changes to the other navigation methods for TreeWalker.

 >7. Consider the consequences if Iterator and TreeWalker added the following
 >   methods derived from attributes of the reference Node:
[SNIP!]
 >   It would then be possible to traverse and process a document of arbitrary
 >   size without ever instantiating the whole tree, and indeed without
 >   creating any Node objects at all!

Yes. And there is nothing to prevent an application from doing so. Since my 
main work since 1995 has been with XML repositories, this kind of 
processing was one of my goals.

Jonathan 

Received on Friday, 24 September 1999 08:53:01 UTC