xml.dom.minidom memory usage

Stefan Behnel stefan.behnel-n05pAM at web.de
Sun Feb 18 10:38:15 EST 2007


Dan wrote:
> I'm using python's xml.dom.minidom module to generate xml files, and
> I'm running into memory problems.

Then take a look at cElementTree. It's part of Python 2.5 and is available as
a separate module for Python 2.4. It's fast, has a very low memory profile and
if you ever decide to need more features, there's lxml to the rescue.

You might also consider streaming your XML piece by piece instead of creating
in-memory trees. Python's generators are a good starting point here.

Stefan



More information about the Python-list mailing list