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

Hello and NodeIterator Revisited

From: Don Park <donpark@quake.net>
Date: Thu, 30 Apr 1998 12:37:20 -0700
Message-ID: <000001bd746f$6b5b9d80$2ee044c6@arcot-main>
To: "www-dom" <www-dom@w3.org>
Hello there.

I would like to point out some of the problems of the NodeIterator design.

1. Mixing iteration operation with indexing operation is not a good.  It is
confusing as well as burdening the implementors unnecessarily.

2. Implementing the 'between' concept of position is elegant but makes
efficient implementation in Java very hard if not impossible.  Due to 'live'
aspect of iterators, each iterator has to be attached to the 'link' between
two siblings.  Cost of object instantiation is heavy in Java.

3. NodeIterator should have a 'release' method to make it possible for the
target node to keep track of active iterators.  C++ has destructor, Java's
finalize is less than useless.

4. Using NodeIterator to iterate an element's Attribute is not wise since
most of the Node methods do not make sense if Attribute interface extends
Node interface.

Frankly, I would prefer the 3/18 version of NodeIterator minus 'live' data
structure as well as getCurrentNode.  If nodes are reference counted, who
cares if is removed or not.  But then I would prefer to have the API settled
down more than anything.  Tennise match without short skirts gets boring
real fast.

That is all for now.

Don Park
http://www.docuverse.com/personal/index.html
Received on Thursday, 30 April 1998 15:44:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:45 GMT