> minidom creates a pretty complete tree data structure, with loads of backlinks
> to parent elements etc. That's where your circular references come from.
>
> I don't know why you want to use pickle here (and not serialised XML or the
> plain in-memory tree), but if memory consumption is an issue, try
> cElementTree, which comes with Python 2.5 (or as an external module for older
> versions). It's faster, more memory friendly and easier to use than minidom.
> There's also lxml.objectify, in case you can't live without pickeling.

I wasn't aware of cElementTree.  When I was looking for examples of
how to parse XML documents, most of the tutorials I came across used
minidom.  Thanks for pointing this out.  I've switched over, and I
like ElementTree much better than minidom (the structure returned by
the minidom parser always seemed overly complex).

I've also gotten rid of the pickling and am storing the XML files as
raw text in directories, so this got rid of my other problem with
shelve.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to