[XML-SIG] PySAX more pythonish

Geir Ove Grønmo grove@infotek.no
26 Apr 1999 09:54:54 +0200


* Paul Prescod
| I would like the attributes parameter to startElement to be defaulted in
| all SAX implementations.
| 
| I would also like a new method called "text" similar to the one
| implemented by xml.dom.sax_builder. "text" just takes a text string
| instead of a string and offsets. That's a little more pythonish for both
| the caller and callback.
| 
| The default DocumentHandler would re-route "characters" to "text". Someone
| who needed the (potentially) more efficient behavior of "characters" could
| override the implementation and re-route text to characters instead.
| 
| What do you think?

I like this. 

There is a small thing to notice in the current implementations: You are
not guaranteed that a sequence of characters is returned by _one_ event
only. Because of buffering in the parsers/drivers you may end up with
several events. This is very inconvenient at times.

Lars Marius has written some code to make sure that these events are
merged into one. I think this was written as a parser filter. I'm not
sure if he intends to include this in the Python SAX libraries, but it
would be very nice to have it available. 

On the other hand, it would also be nice to have the text method do
this. :-)

All the best,
Geir O.