[XML-SIG] Uniform interface with Python 2.0
Lars Marius Garshol
14 Sep 2000 10:35:43 +0200
* Martin v. Loewis
| [xml.sax.parse(file, MyHandler())]
| It's not SAX compatible, though, is it?
It is if we say it is. :-)
| In SAX, I'd expect to create a reader object using some out-of-scope
| operation, then invoke setContentHandler() on this object. I think
| that should be supported somehow.
I agree, and I think we should retain that in SAX 2.0. However, I
think Paul is right in that the parse function is useful as a
shorthand that captures what you want to do in 95% of the cases.
| What was wrong with sax2utils.make_parser() to not include it in
| Python 2?
I think we should extend it so that the default parser list can be
modified both from Python code and set via an environment variable
(PY_SAX_PARSER?). Other than that I think SAX 1.0 showed this
approach to be very successful.
It should probably appear as
from xml import sax
parser = sax.make_parser()