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

Alex Martelli aleax at aleax.it
Fri Jul 12 04:37:59 EDT 2002


Jonathan Hogg wrote:
        ...
> I'm not sure it is possible to "overuse" XML. 

It is -- easily.  My pet peeve is the idea of using XML files for
tasks that obviously need a real database, preferably a relational one.

I think some people never really GOT relational databases, no matter
that they've been around for decades and are so widespread, and they're
now turning to *overusing* XML to cover up for that:-).

> If you need to read and
> write structured data, why bother coming up with your own format? (see:
> the entire contents of /etc) Or why use something that is proprietary to a
> particular language or system? (see: Pickle)

Speed, size, and convenience are possible reasons.  If the structure
is highly repetitious, and the amount of data is very large, then
repeating the tags identically a zillion times can impose substantial
overhead of space and time.  Pickling and unpickling can be (say)
twice as fast and consume half as much space as going to an XML
format.  That doesn't really matter unless the amounts of data are
huge, of course.  But the point is, sometimes they ARE.  I/O-bound
programs are hardly a thing of the past: CPU's get faster much
faster than networks and disks get faster.

The need to search "random-access" wise, or "keyed"-wise, is often
an excellent reason to avoid a format that requires reading though
all of a file to get at a particular piece of data.  dbm variants,
shelve, and relational databases, can be huge wins here (compared to
XML, pickle, or any other choice requiring whole-file reloading).

While XML is reasonably human-editable, there may well be formats
that are more convenient than it for this purpose, avoiding the
need of special-purpose XML-oriented editors and allowing the use
of any good old text editor with maximal ease.  This is a good
reason to keep a human-editable configuration file in non-XML
form, in my opinion.


Let's try to avoid pro-XML hype in an attempt to counter the
anti-XML hype that's suddenly burst on this group...:-)


Alex




More information about the Python-list mailing list