high level, fast XML package for Python?

Steven Bethard steven.bethard at gmail.com
Mon Sep 18 01:15:32 CEST 2006

Martin v. Löwis wrote:
> Gleb Rybkin schrieb:
>> I searched online, but couldn't really find a standard package for
>> working with Python and XML -- everybody seems to suggest different
>> ones.
>> Is there a standard xml package for Python? Preferably high-level, fast
>> and that can parse in-file, not in-memory since I  have to deal with
>> potentially MBs of data. 
> It seems that everybody is proposing libraries that use in-memory
> representations. There is a standard xml package for Python, it's
> called "xml" (and comes with the standard library). It contains a
> SAX interface, xml.sax, which can parse files incrementally.

To use ElementTree and keep your memory consumption down, consider using 
the iterparse function:


Then you can get more SAX-like memory consumption while still enjoying 
the high-level interface of ElementTree.


More information about the Python-list mailing list