Re: XML APIs

Mike Champion <mcc@arbortext.com> writes:

> At 05:59 PM 10/26/98 -0500, Catherine Kohlhase wrote: 
> >>>>
>> The new version of DOM (July 20) does not include a section for XML APIs.
>> The old version (April 1998) does include a section for XML APIs and the
>> XML APIs use some obsoleted classes (NoteIterator..)  Do you know if a new
>> version of XML APIs is coming soon or should we use NodeList instead of
>> NodeIterator?   Thanks for your time.

> NodeIterator was removed from the Level 1 spec; something like it will
> return in Level 2.  In the meantime, use NodeList.

It's actually rather easy to implement TreeIterator using the various
parent, child, and sibling attributes of Node.  It is also trivial to
implement a NodeIterator for the children of a node.

The thing that's difficult is to get an instance of the correct iterator
class from a NodeList; a generic iterator that just keeps track of an index
and uses "item" is likely to be extremely inefficient.  However, I believe
there are very few places where you can't use navigation (and hence an
iterator) instead of using a NodeList.

The bottom line is that if you're working in a language that lets you define
your own classes (i.e. not JavaScript), you can simply implement your own
iterators and use them where they're appropriate.  This will have the
additional advantage that if iterators _do_ come back, you won't be stuck
with whatever baggage the spec includes that your application doesn't need.

-- 
 Stephen R. Savitzky   Chief Software Scientist, Ricoh Silicon Valley, Inc., 
<steve@rsv.ricoh.com>                            California Research Center
 voice: 650.496.5710   fax: 650.854.8740    URL: http://rsv.ricoh.com/~steve/
  home: <steve@starport.com> URL: http://www.starport.com/people/steve/

Received on Monday, 2 November 1998 14:04:57 UTC