Re: question: NodeIterator in DOM
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 sense. Tyler xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format