[XML-SIG] DOM code now in CVS tree
Sun, 4 Oct 1998 16:05:53 -0700
> * Attributes in the IDL DOM definition are implemented as
> methods, prefixed with get_. For example, to retrieve the childNodes
> attribute, you call .get_childNodes() .
> This is not an optimal solution. Ideally it would be as
> simple as accessing .childNodes, but this faces some problems. First,
> the low-level tree of elements is implemented as a tree of _nodeData
> instances, with no circular references. Element, Text, etc. instances
> are then implemented as proxies for the corresponding _nodeData
> instance. This provides two useful features:
> 1) If there are several proxies for a given _nodeData,
> changes are instantly visible to all of the proxies.
> 2) As Ken McLeod suggested, this should avoid circular
> references, and, therefore, memory leaks. (I haven't
> actually verified that there are no leaks, though.)
> However, this also means that just setting up static
> childNodes attributes would break property 1. So you'd have to write
> __getattr__/__setattr__ functions. I'm worried that this would exact
> too great a performance penalty. Thoughts?
In both cases, you're executing a method, so I don't see that there would be
much of a perf difference. Go for __getattr__.
> * You can add extended interfaces and still remain compliant
> with the Recommendation. Therefore, feel free to suggest other useful
> things. I've added a few convenient aliases: the DOM spec specifies
> get_nodeName() and get_nodeValue(), so I've added get_name() and
> get_value(). We can add other alises to fix other annoyances.
You could always create subclasses of the DOM code for the Python-extended
versions. Have a "pure" version and one with the additional Python
interfaces. This goes along with the getattr from above.
Greg Stein (firstname.lastname@example.org)