[XML-SIG] DOM Considered Harmful :-)

Sean Mc Grath sean@digitome.com
Tue, 04 May 1999 14:19:39 +0100


[Greg Stein]
>
>2) the close() method and parent/sibling relationships
>
>Adding parent/sibling relationships introduces loops unless you use
>proxies or introduce a close() method (if there is another way, then I'd
>like to learn it).

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:-

	
	def __del__(self):
		self.Home() # Move current position to root of tree
		from LJUtils import DescendantsInclusive
		for item in DescendantsInclusive(self): # iterate a node list
			item.node.North = None # break all links
			item.node.South = None
			item.node.East = None
			item.node.West = None



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