[XML-SIG] Subclassing xml.dom.minidom

Fred L. Drake, Jr. fdrake@acm.org
Thu, 24 Apr 2003 15:31:45 -0400


Nicholas M. Kirsch writes:
 > I have looked for information (er.. I've googled) and have not found any
 > examples of anyone subclassing minidom.
 > 
 > I want to modify the behavior of some of the methods in Node, etc.
 > 
 > Naturally, I want xml.dom.minidom.parse to return objects which are all
 > subclassed as well.

There is some information in the Python/XML Reference Guide, included
with the PyXML sources.  I don't know that there's a formatted version
of the document available online, unfortunately.

Depending on just which node types you want to affect, this may be
fairly easy, or it may be more painful.  Changing Text nodes will be
most difficult if you intend to use xml.dom.xmlbuilder without further
subclassing.

At the very least, you can expect to subclass the DOMImplementation
and Document classes (to control the factory functions) and the
specific node types you want to affect.

I'll be glad to try and answer further questions, but you'll need to
be more specific.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation