Simple XML-to-Python conversion

Ivan Voras ivoras at
Sat Mar 19 15:15:37 CET 2005

gaudetteje at wrote:
> I've been searching high and low for a way to simply convert a small
> XML configuration file to Python data structures.  I came across gnosis
> XML tools, but need a built-in option for doing something similar.

I too needed such thing, and made this simple parser:

It's really quick and dirty. It doesn't even use standard parsers such 
as dom or sax, but improvises its own. It's also very likely to fail in 
mysterious ways when it encounters invalid XML, but for quick and dirty 
jobs, it's very nice and easy. See the bottom of the file for some quick 

More information about the Python-list mailing list