[XML-SIG] sgmlop and xmllib.py compatibility

Fredrik Lundh fredrik@pythonware.com
Sat, 29 Aug 1998 16:55:57 +0100

>I'm finally getting back to working on the XML code.  A while back
>Sjoerd checked in various fixes to the xmllib.py in the Python 1.5 CVS
>tree; these changes result in a divergence between FastXMLParser
>(which uses sgmlop) and the regular XMLParser in xmllib.py.  Looking
>at it, I'm wondering why FastXMLParser isn't a subclass of the
>original XML parser that overrides certain methods, but instead copies
>the methods of xmllib.XMLParser.  Subclassing would seem to make
>keeping the two compatible slightly easier.
> Any thoughts?  Fredrik?

There's a reason for this: sgmlop is much, much faster if
certain seldom used handlers aren't defined at all on the
Python level.  Extending the standard class (which provides
stubs for all these methods) would slow things down quite
a bit.

A better solution would be to use a common baseclass for
both parsers, but I haven't had time to figure out how such
a beast would look...  and then I need to talk Sjoerd into
supporting that design.

But I hope to find some time to work on sgmlop real time

Cheers /F