[XML-SIG] Reconsidering the DOM AP
Thu, 29 Jun 2000 22:30:40 +0100
>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.
For the event handling stuff, the principle difference is just
down to the convenience of event handlers named after element
type names. If it were just the event-oriented stuff, then
Pyxie would not offer enough to drag even me away from
the industry APIs:-)
The big differences come in the tree process stuff which
is what I personally use day in day out.
1)Pyxie uses a "cursor" location metaphor and a
cut/paste approach which is very different from the
DOM. I find the Pyxie approach more natural than
the DOM approach.
2)Pyxie blends the ease of use of tree-oriented processing
with the memory efficiency of event-oriented processing
using a sparse-tree facility. This is no such facility
in industry APIs (that I know of).
3)Pyxie allows you to mix logical navigation with
parsing and content insertion in a way I find
very useful in my day to day work. This sort of thing:-
T1.Home() # Root of tree T1
T2 = T3.Cut() # Cut branch out of T3
T1.PasteDown() # Paste into T1
T1.Down # First child of T1
# Paste in the current time as a <time> element
T1.PasteDown (StringxTree("<time>%s</time>" % time.ctime(time.time()))
I naturally think in terms of cut/paste when doing
tree transformations. The Pyxie API gives me
a simple syntax to express cut/paste-oriented
4) Pyxie is unashamedly focused on the logical
model of XML documents. It does not concern itself
with general entity references, DTD info etc. etc.
Pyxie achieves API simplicity by purposely
leaving a lot of things out:-)
I happen to believe that it keeps all the important
This is a controversial opinion.
XML Processing With Python
ISBN: 0 13 021119 2