Parsing XML: SAX, DOM, Expat, or Something Else?
aquil.abdullah at gmail.com
Fri Jan 23 20:19:07 CET 2009
I've been charged with developing an XML configuration file format,
for one of the applications that my company develops. (Yes, I know it
would have been easier to just use the configuration file format as
described in RFC 822) While I am finally comfortable with the XML
description that we've agreed upon; I am still trying to determine the
best XML parser API to use. I would love to use XPATH, however I face
the following restriction:
The Python scripts that perform the parsing of the XML configuration
file must be compatible with Python Versions 2.2-present.
This means that any functionality that I use needs to be compatible
with Python 2.2.
I started with the DOM API in xml.dom.minidom and I thought that it
might be the best way to go, but then I ran across the Recipes of Wai
and John Bair, Christoph Dietze from the second edition of the Python
Wai's implementation uses thes SAX parser and John and Christoph's
implementation uses Expat API.
In the end what I really want is to transform the XML
into an object that looks like
config.component.setting or a map config[component][setting].
Another restriction is that I don't want to have to ship additional
Does anyone have any advice, comments, or HELP???
Aquil H. Abdullah
More information about the Python-list