[XML-SIG] DOM Considered Harmful :-)

Sean Mc Grath sean@digitome.com
Tue, 04 May 1999 21:41:56 +0100


>> Sean Mc Grath wrote:
>> >
>> > In LumberJack, a collection of nodes (LJNode objects) are
>> > associated with a tree object known as an LJTree. When the
>> > reference count of an LJTree shrinks to zero LumberJack
>> > walks the associated, doubly linked LJnodes and
>> > breaks the double links:-
>> 
>Greg Stein wrote:
>> How could the tree ever hit a refcount of zero? If the tree refers to
>> the Nodes and the Nodes to the tree, then you have a reference loop.

The tree references the root node. The is no link back from the 
root node to the tree and this no circular reference. 
Users of LumberJack think in terms of tree objects - not nodes
or node lists.

The tree object serves to maintain a "current position" on behalf
of the user. It is also the place where the tree level methods
hang - things like cut(), paste() and so on.

One interesting side-effect of the tree/node combo is that
with LumberJack you can easily manipulate inter-tree node-lists. A 
NodeListItem is a combination of tree object and node object so
you can build lists of these things that contain bits of 
lots of different trees. I'm sure some day now I'll think
of a really good application for that...:-)



<Sean uri="http://www.digitome.com/sean.htm"/>