Paul Boddie paul at boddie.net
Tue Jun 24 10:52:27 CEST 2003

"A.M. Kuchling" <amk at amk.ca> wrote in message news:<7ECdndDM99Lkq2qjXTWcqw at speakeasy.net>...
> I've come to the conclusion that the initial concern for supporting APIs
> such as SAX and DOM in Python was a mistake; many bugs stem from trying to
> support interfaces that don't map to Python very well.  Instead we should 
> have made nice Pythonic interfaces such as effbot's ElementTree which are
> simpler to implement and to use, and ignore the W3C's APIs.

The thing is that Python and its developers quite often have to live
(and work) alongside other technologies; having a set of common APIs
is important if you consider them in that context. The other issue is
that the Python community isn't always supreme at standardising
things, working through the edge cases, and so on, and one might well
argue that the DOM specification has at least had a lot of attention
on most areas to be considered generally robust. I haven't seriously
looked at most of the "Pythonic" APIs, but I would be quite concerned
about interoperability, how comprehensive they are (with respect to
representing all XML details), and what the options are for increasing
performance without pervasive source code changes.

> SAX isn't too bad in this respect[1] -- pull APIs look pretty similar,
> differing only in interface and method names -- but the DOM has been a mess,
> spawning several implementations all of which are fairly complex.

I like the work that Andrew Clover did with regard to testing the
different DOM implementations for Python:


I'll agree that it's probably quite demanding to write a DOM
implementation and support various levels of compliance. However, I'd
argue that as a user of such implementations, one does gain from the
broad compatibility between implementations - certainly, I've used
cDomlette and minidom interchangeably for some time with the only
major issue being a library "collision" around Expat and mod_python
with cDomlette.

> [1] SAX is a _de facto_ API, not a W3C one; perhaps that explains why it's
>     not too bad.

Certainly, the W3C DOM had dubious beginnings, but I don't personally
buy into the widespread arguments that it is found seriously lacking
in a number of supposedly key criteria. Or at least, I don't really
see many of the supposedly better alternatives as being noticeably
better, especially when DOM as a "platform" supports some very useful
technologies indeed.


More information about the Python-list mailing list