[XML-SIG] Namespace support for DOM

Dieter Maurer dieter@handshake.de
Fri, 1 Jan 1999 13:39:28 +0100


Andrew M. Kuchling writes:
 > 	Indeed; I'm frightened of adding some sort of clever,
 > invalidate-namespaces-on-a-move, scheme and opening the door to lots
 > of subtle bugs.  Also, the PyDOM representation has nodes with a list
 > of their children, and no parent pointers; this makes the traversing
 > of ancestors difficult.  I'm somewhat tempted to toss the recently
 > announced WeakDict object into the XML package and add parent
 > pointers, but it may be too late to undertake such a large change to
 > the DOM code.  Any opinions?

If we decide to use the WeakDict module, I could help to adapt the
DOM code.

There is, however, some subtle semantic difference between
the current implementation and a WeakDict based one.
This difference shows up, when we get a reference to an internal
node of a dom tree and then delete the dom tree (still holding
the reference).
In the current implementation, the referenced node contains
a "_document" ("ownerDocument") attribute which protects the complete tree
from being garbage collected.
In a WeakDict based implementation, the reference to the
"ownerDocument" is nutarally implemented as a week reference (as
are the parent references). Deleting the dom tree deletes
everything from its root down to the referenced internal node.
Thus, this node looses its parent and the "ownerDocument" reference.
It can only be used thereafter in a very restricted way.

Dieter