[XML-SIG] Reconsidering the DOM API

Ken MacLeod ken@bitsko.slc.ut.us
29 Jun 2000 11:02:35 -0500

Patrick Phalen <xml-sig@teleo.net> writes:

> [Michael McLay, on Tue, 27 Jun 2000]
> :: Perhaps it is time to step back and ask how easy XML could be if
> :: the Python interface had nothing to do with SAX or DOM.
> How easy? Having just read through Sean McGrath's impressive new book,
> _XML Programming with Python_, I'd have to answer "very easy indeed."
> Sean's notion of using the very simple, Python friendly, Pyxie API is
> atttractive. I admit I was suspicious of the idea at first, but became
> a convert after seeing it in action. It allows me to do the great
> majority of XML work I face in a comfortable, Pythonic way.
> His further notion that Pyxie should support language-independent XML
> processing APIs (namely SAX and DOM) in a compatibility layer is also a
> natural.

Pyxie basically provides three things:

 * the ESIS format so Pyxie utilities can be easily chained together
   on the command line (the CLI equivalent of chaining SAX filters)

 * an event based parser API VERY similar to SAX (plus what would be a
   SAX filter) but not compatible with SAX.

 * a tree based API VERY similar to DOM (plus some convenience
   methods) but not compatible with DOM.

It's these last two that bug me about Pyxie.  Looking at Pyxie.py, I
don't see why Pyxie could not have used Python SAX and DOM and have
been just as simple.  As far as I can tell, Pyxie is merely different.

This is not an argument against Pyxie's convenience functions which
make Pyxie so easy to use and what draw so many people to it!  My
concern is that this could have easily been done _with_ SAX and DOM
and avoided unnecessary incompatibility.

  -- Ken