[Tutor] XML to Python

Kent Johnson kent37 at tds.net
Fri May 6 04:50:06 CEST 2005


Smith, Jeff wrote:
> I'm able to use the built in XML parser to effect "normal" XML parsing usage but frequently, I'm
not doing anything to complicated and would simply like to translate the XML file into a more
"Pythonic" structure. What's the best way to do this? Something from the standard libraries would be
preferable.

I don't think there is anything in the std lib for this. I like ElementTree a lot for XML parsing. 
It is easy to use for simple tasks; for more complicated stuff I find I often have to add a little 
glue code to it but that is not hard either.
http://effbot.org/zone/element.htm

This article is a survey of Python XML tool. Look at the  Data Bindings and Specialized APIs section 
for more suggestions:
http://www.xml.com/pub/a/2004/10/13/py-xml.html

Kent



More information about the Tutor mailing list