W3C home > Mailing lists > Public > www-dom@w3.org > January to March 1999

Re: Level 2 iterators

From: Arkin <arkin@trendline.co.il>
Date: Fri, 05 Mar 1999 16:21:13 -0500
Message-ID: <36E04AC9.28B84257@trendline.co.il>
To: John Cowan <cowan@locke.ccil.org>, DOM List <www-dom@w3.org>


John Cowan wrote:
> I don't think you can, if the black box is allowed to mutate the
> tree in arbitrary ways.  In particular, a mutator that uses the
> rule "Remove the current node and append it to its current parent"
> will cause any reasonable iterator to loop, or at best fail.

What my black box do is act on the current node by either removing it,
replacing it or just changing it. It's part of the OpenXML processing
API. It is implemented as two separate operation, one iterating the
document tree the other one changing the current node.

If a node is replaced with a different node or moved elsewhere, it will
be iterated twice, and that's fine. If the node becomes the last child,
it can do so only once. What you suggest is an extreme case that will
break it, but anything is breakable if you try hard enough.

I came up with this example to illustrate that a locking mechanism is no
solution. Before an implementation can become concurrent by adding
locking it should first be tested to work reasonably well in a single
threaded application. If you try hard enough you will find that many
algorithms break when they are put to this test, even when only one
thread is involved in the process.

Arkin

PS
Just realized you're the guy behind XCatalog and DOMParser. I would like
to introduce myself as the guy behind OpenXML (www.openxml.org) and
would like to know if: a) you have plans for proposing XCatalog as a W3C
draft, and b) any ideas for an XCatalog based API?


> 
> --
> John Cowan      http://www.ccil.org/~cowan              cowan@ccil.org
>         You tollerday donsk?  N.  You tolkatiff scowegian?  Nn.
>         You spigotty anglease?  Nnn.  You phonio saxo?  Nnnn.
>                 Clear all so!  'Tis a Jute.... (Finnegans Wake 16.5)
Received on Friday, 5 March 1999 16:27:18 GMT

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