python and parsing an xml file

Ian hobson42 at gmail.com
Tue Feb 22 06:01:42 EST 2011


On 21/02/2011 22:08, Matt Funk wrote:
>> Why?
> mmmh. not sure how to answer this question exactly. I guess it's a
> design decision. I am not saying that it is best one, but it seemed
> suitable to me. I am certainly open to suggestions. But here are some
> requirements:
> 1) My boss needs to be able to read the input and make sense out of it.
> XML seems fairly self explanatory, at least when you choose suitable
> names for the properties/tags etc ...
> 2) I want reproducability of a given run without changes to the code.
> I.e. all the inputs need to be stored external to the code such that the
> state of the run is captured from the input files entirely.
>
>
Hi Mark,

Having tried XML for something similar, I would strongly advise against 
it.  It has been nothing but a nightmare.

XML is acceptable for machine to machine communication where the two 
sides cannot agree a common
language in advance or they can't coordinate format changes. Even then 
it is slow and verbose.

Use the config module if the configuration is simple to moderately complex.

Consider JSON or Python (source) if your requirements are really 
complicated.

Regards

Ian








More information about the Python-list mailing list