[XML-SIG] Re: Generating XML from scratch

Dave Kuhlman dkuhlman at cutter.rexx.com
Fri Feb 11 18:48:26 CET 2005

On Wed, Feb 09, 2005 at 03:22:09PM -0500, Rich Salz wrote:
> >What makes one want to avoid the DOM interface? Do you know any docs/links 
> >which discuss this further? How tied to Python is your opinion on DOM?
> I think that last question is the key point.
> DOM is very much un-python.

OK, I'll bite.  Which characteristics make DOM un-pythonic?  Or
are we just talking about a general ick-factor here?  Maybe the
minidom API is somewhat of a mess, but then so are XML and the XML
documents that minidom must be able to represent.

> If you are "just" generating XML, then you will probably go faster if 
> you use things that naturally fit into the python programming idioms.

Which things are those "that naturally fit into the python
programming idioms"?  Is it the writer idiom stuff?

My understanding is that ElementTree occupies the same niche and
satisfies the same needs as the Python implementation of DOM (for
example, minidom).  I'd like to see some sort of comparison of
minidom and ElementTree.  Are there some real reasons why I should
choose ElementTree over minidom for future work?

Is there a consensus that we should be using ElementTree instead
of minidom?  If so, it seems that this should be mentioned in the
standard "Python Library Reference" sections on DOM and minidom
rather than being a "secret known but to a few" on this list.


Dave Kuhlman

More information about the XML-SIG mailing list