python and parsing an xml file

Matt Funk mafunk at nmsu.edu
Tue Feb 22 14:09:54 EST 2011


Hi,
first of all thanks everyone for the (at least to me) valuable
discussion about xml and its usage domain.
Also thanks for all the hints and suggestions.
In terms of my problems, from what i can tell right now the ConfigObj4
(see:
http://www.voidspace.org.uk/python/configobj.html#reading-a-config-file)
will suit my needs.

Again, thanks for the time and effort you put in to answer my questions
(and, in Stefan's case for writing tools and making them available to
everyone) and pointing me in the better direction.
matt


On 2/22/2011 4:01 AM, Ian wrote:
> 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