xml.sax.xmlreader and expat

Stefan Behnel stefan.behnel-n05pAM at web.de
Wed Jun 28 08:40:24 CEST 2006


Fredrik Lundh wrote:
> Gary Robinson wrote:
> 
>> We're using xml.sax.xmlreader in our app (http://www.goombah.com,
>> which is written in Python).
>>
>> In Python 2.3.x, does that use the C-language expat under the hood?
> 
> yes.
> 
>> The reason I'm asking is because we're wondering if we can speed up
>> the parsing significantly.
> 
> if you want speed, you don't really want any of the xml.sax or xml.dom
> stuff.  I'm a bit biased, but I'd recommend the iterparse interface to
> cElementTree

or to lxml (if you want to do more than just parsing):

http://cheeseshop.python.org/pypi/lxml/1.1alpha

Why?

http://effbot.org/zone/celementtree.htm#benchmarks
http://codespeak.net/lxml/performance.html#parsing-and-serialising

Stefan



More information about the Python-list mailing list