[XML-SIG] PyXML vs. stdlib xml.sax

Mike Brown mike at skew.org
Fri Oct 28 05:54:42 CEST 2005

What exactly does PyXML's xml.sax offer that isn't in stdlib? I have been 
having trouble locating any docs that answer the question "why would I want to 
install this?"

After looking in various places (mainly the source code), I get the impression 
that you would want PyXML's xml.sax libs if you...

* want to use SAX in Python < 2.0 (xml.sax wasn't in stdlib until Python 2.0), or
* want stdlib xml.sax bug fixes made after the release of your version of Python, or
* want SAX 1 drivers, or
* want a larger set of SAX 2 drivers (in stdlib there is only a driver for Pyexpat,
  whereas PyXML gives you drivers for PyXML's xmlproc and Python's htmllib, sgmlop,
  and sgmllib), or
* want these enhancements that are not yet (and may never be) in Python xml.sax:
    * xml.sax.saxlib - SAX 2 core interface classes
    * additions to xml.sax.saxutils, including:
        * unescape(), a function which does the inverse of escape()
        * AttributeMap, a SAX 1 AttributeList implementation
        * Location, a SAX 1 & 2 Locator implementation
        * DefaultHandler, a SAX 2 DefaultHandler interface class
        * Canonizer, a SAX 1 DocumentHandler that produces Canonical XML
        * ContentGenerator, a SAX 1 DocumentHandler wrapper for XMLGenerator
          (which is an XML-serializing SAX 2 ContentHandler)
        * ESISDocHandler, a SAX 1 DocumentHandler that produces naive ESIS output
        * LexicalXMLGenerator, an XMLGenerator that also supports the SAX 2 
          LexicalHandler interface
        * BaseIncrementalParser, a minimal IncrementalParser for driver authors
        * EventBroadcaster, a class that relays method calls to multiple objects
    * xml.sax.saxexts - experimental extensions, including:
        * parser factories for XML, SGML, and HTML, supporting all the SAX 1
          drivers in PyXML
        * ExtendedParser, an extension of the xml.sax.saxlib.Parser interface
    * xml.sax.sax2exts - experimental SAX 2-specific extensions, including:
        * parser factories for XML, SGML, and HTML, supporting all the SAX 2
          drivers in PyXML

Does this look right? What other differences are there?


More information about the XML-SIG mailing list