OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: question: NodeIterator in DOM

[ Lists Home | Date Index | Thread Index ]
  • From: Tyler Baker <tyler@infinet.com>
  • To: Akitoshi Yoshida <akitoshi.yoshida@sap-ag.de>
  • Date: Mon, 18 May 1998 08:34:10 -0400

Akitoshi Yoshida wrote:

> Hi,
> Another question regarding NodeIterator:
> You have an NodeIterator instance with the iterator
> position set somewhere in the middle. When you
> remove three nodes: first, the node just after the
> iterator position, second the node after this removed
> node, and finally the node just before
> the original iterator position,
> then what should toNextNode() and toPrevNode() return?

Essentially a similiar problem occurs in the JDK 1.2 Collection classes.  What
JavaSoft suggests is that for all Iterators (a new interface in the JDK 1.2
Collection classes) you synchronize on the object being iterated so that no
internal changes to the object's state are made while iterating.  Since DOM is
supposed to be architectural and language neutral, languages which lack
synchronization support may find some difficulty in making sure that an object
which returns an Iterator object is not mutated while iteration is occurring in a
multithreaded environment.  If your application is single threaded, you should
not have to worry about your object (such as a List) that returns the Iterator
object being mutated except for programming error where you add and remove
objects to the object returning the Iterator object while iterating.  Sorry to be
so convoluted here but I got 3 hours of sleep last night so I hope the above made


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS