Simple XML-to-Python conversion

Ivan Voras ivoras at _-_fer.hr
Sat Mar 19 15:15:37 CET 2005


gaudetteje at gmail.com 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:
http://ivoras.sharanet.org/projects/xmldict.py.gz

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 
examples.



More information about the Python-list mailing list