[XML-SIG] python SAX API

Martin v. Loewis martin@v.loewis.de
Fri, 16 Nov 2001 18:40:18 +0100


> The startElementNS is one. 

This was discussed in length, and I believe the Python approach is better than the Java one.

> The namespace feature is another one.

Isn't it the same one? They go together.

> Different parsers not implementing the same spec is yet another
> one. Different parsers representing empty nsuri with empty strings
> or None is another major pain.

There are certainly bugs, and certainly, they should be fixed. Are you
saying Java is without bugs ?-)

> Now, if we are going to change the SAX API substancially, I'd say
> that SAX is a poor choice of a name, because people used to the real
> things will get the impression that they do not need to read the
> Python doc, and will get bitten when:

It's not going to change substantially. It is "in force" since Python
2.0; both the documentation and the expatreader implementation. These
are cast in stone, and can only change if they are inconsistent with
each other (as is the case for the namespaces feature).

Everything else has to follow the documented API, which can only be
extended, not changed.

>  * the startElement callback generates an exception because it gets called
> with the wrong number of arguments

Why would that happen? The most frequent problem was that characters()
is called with the wrong number of arguments, when people where
converting their SAX1 document handlers.

> At that point, they will have read the python sax documentation (and will
> have ROTFLed when seeing the reference to the Java SAX API website)

We can certainly remove the reference to the Java website if you think
it would help...

> and they'll be able to fix things, and they'll presumably have
> noticed that the prototype of the characters() callback is
> different. However, in the process, they'll have gotten a very messy
> impression of the XML support in Python.

They have all kinds of bad feelings towards XML support in
Python. They think the documentation sucks, they think there are no
examples, numerous bugs, and that it is way too slow. Furtunately,
people using XML with any other language have the same feelings: The
DOM is way to complex, Unicode is terrible and shouldn't be done, and
there really should be a RubyWay API for doing things - but there
isn't even that.

I still think that SAX is a simple API for XML.

Regards,
Martin