XML overuse? (was Re: Python to XML to Python conversion)

Peter Hansen peter at engcorp.com
Thu Jul 11 23:41:10 EDT 2002


Jeremy Bowers wrote:
> 
> (Thought: XML should never be your *first* choice of file format. It is
> the choice of *last* resort, when you absolutely *need* easy parsing in
> multiple languages or environments and can't get it any other way. It is
> then a much better choice then other formats, but only under those
> limited, albiet extremely popular, conditions.)

I have to disagree with those who say, in effect, that XML is such 
an unsuitable technology that it is truly a last resort.

XML was adapted from SGML to meet several key goals.  Among those
was the desire to make a format which was easily human-readable
and editable using simple tools like text editors.  For some people,
this is a *hugely* beneficial benefit of using XML even for storage
of simple data structures, which binary and/or specialized formats
such as pickles do not have.

In addition, it leaves open the possibility of very easily 
processing the data using one of the steadily growing number
of XML utilities.  One extremely simple example of this sort
of thing is using IE to load an arbitrary XML file to observe
that the file is in fact well-formed, and to get a quick idea
of the structure of it.  Not quite so simple with some other 
formats.

It's obviously a religious issue, but I get the feeling that while
some buy into the XML hype wholesale, and overuse it to their 
detriment, others are now jumping on some anti-XML bandwagon 
(possibly) without having really put it to the test.  I often find 
that a choice to use XML opens up interesting avenues which would not
even have occurred to me had I started off with another format,
and so far I'm not sure I regret any particular case where I've
used it.

Now I'm *not* saying XML is always a first choice, and certainly
a pickle is quite likely the Simplest Thing That Could Possibly
Work and therefore a good first choice, but I do not think it
deserves to be relegated to the abyss of "last resort".

-Peter



More information about the Python-list mailing list