[omaha] XML in Python

Eric Edens eric.edens at gmail.com
Tue Oct 4 06:00:09 CEST 2011


Hey Shawn,

Python has a few options for parsing/representing XML (DOM/SAX/ElementTree).
 Now, as to which is more Pythonic, here it is from Guido:

Finally, compared offerings based on e.g. 4thought (sp.?), ElementTree feels
much more practical and hence, might I say it, "pythonic".  --
http://mail.python.org/pipermail/python-dev/2005-December/058643.html

Also, Dive Into Python 3 only covers ElementTree,
http://diveintopython3.org/xml.html#xml-parse.  So there's a couple for
ElementTree.  SAX could be a good option if you have a super huge file --
it's a stream-based processor.  And if you need to follow the DOM standard,
then there're a few libraries for that too.

Stanford has a good lecture covering XML parsing in Python, however it only
covers SAX and DOM.
http://academicearth.org/lectures/xml-processing-and-python

-- Eric


More information about the Omaha mailing list