[XML-SIG] New to Python OO

Michael Sanborn michael@graphion.com
Fri, 11 Dec 1998 10:11:58 -0800


Suppose I wanted to create a customized method to write out a DOM tree,
say as plain text, like a totxt() paralleling toxml(). And say my
program
imports xml.dom.core and xml.dom.builder. I would have thought that the
way to approach this would be to define a local Node class derived from
core.py that added an empty totxt() method, and then to define local
subclasses of Node (such as Text) with specific totxt() methods. My
reasoning was that the Builder class would then build the tree with my
enhanced Nodes. But that doesn't seem to be happening. Instead, Builder
seems to be constructing the tree with regular core Nodes that don't
recognize my totxt() method. Can anyone give me advice on how to achieve

this?

Thanks,

Michael Sanborn
Graphion Typesetting