RE: Alternative to the Live NodeIterator

> -----Original Message-----
> From: Mike Champion [mailto:mcc@arbortext.com]
> Subject: Re: Alternative to the Live NodeIterator
 . . .
>>  It seems to require that a globale list of all NodeIterators be maintained
>> somewhere, each with a abstract description of the search criteria.  Every
>> time a node is added (or worse, an entire tree), it has to compared every
>> search criteria and additional processing may be require to determine
>> ordering.
>
> I certainly hope not!  It has always been my assumption that each
> NodeIterator knows where it points to in the tree (e.g., "after the Node at
> address 0xbeef0666"), and when a call comes to re-position the iterator or
> return its next or previous node, it would use the tree itself to
> re-position it properly.

The reference cannot be directly to the node; what if the referenced node is
removed?

So the reference must begin from some parent.  Then I have to ask how does
this work if the reference node is deleted?  What if several nodes are
deleted, destroying both indexes and identity references?

I think either a backend event interface or a marker node within the tree are
required.  Both concepts require references to the node iterators.

> If the iterator has search criteria ("filters" is
> the current DOM terminology), then the filter would be applied before
> deciding which Node to return.

The implications of what you are suggesting have a huge overhead.  For
example, on every next() a NodeIterator acquired from
Document.getElementsByTagName() would have to search through all nodes after
the previously returned node just to make sure no new nodes that match the
filter are available.  It completely eliminates the possibility of a simple
data structure to contain all references.

With regards to Don Park's recent email, if 'live' iterators are a necessity,
I support his proposal for a 'release()' method for NodeIterators.


Andrew n marshall
  student - artist - programmer
     http://www.media-electronica.com/anm-bin/anm
      "Everyone a mentor, Everyone a pupil"

Received on Friday, 1 May 1998 04:07:53 UTC