xml.parsers.expat vs. xml.sax

Martijn Faassen faassen at infrae.com
Tue Apr 27 14:34:31 EDT 2004


Thomas Guettler wrote:

> What are the difference between xml.parsers.expat
> and xml.sax?
> 
> Up to now I used xml.sax.make_parser and subclass
> from ContentHandler.
> 
> I think xml.sax.make_parser uses expat as default.
> Why should I want to use xml.parsers.expat?

expat is slightly more low level. It *may* be more efficient but I 
wouldn't care about that.

Using sax instead of expat is usually (always?) the right decision. 
There is more published API for sax, knowledge carries over from other 
languages, and sax has multiple implementations in Python.

Regards,

Martijn



More information about the Python-list mailing list