Hello,
I'm fairly new to Python but I've had a fair bit of experience
in SAX.
Basically xml.sax.XMLReader is a simple implementation that doesn't
do anything when you call parse, setFeature etc. Expat is an
implementation of the XMLReader, therefore in actual fact you will never
know that you are using Expat as an SAX XMLReader implmentation and you
never should need to know - it is simply returned from make_parser The
reason that SAX has this mechanism is that it easily allows you to
switch implementations in and out. Take a look at the source code and
it immediatly becaomes clear!
This makes more sense in other languages which have formal
interfaces but Python doesn't have such a thing (although you can
acheive the same effect in other ways if you so desire).
PS I'm new to Python so if that's wrong for the Python SAX
implementation then please let me know!
Cheers,
Neil
Thomas said:
Hi!
What are the difference between xml.parsers.expat
and xml.sax?
Up to now I used xml.sax.make_parser and subclass
from ContentHandler.
I think xml.sax.make_parser uses expat as default.
Why should I want to use xml.parsers.expat?
Regards,
Thomas
--
Neil Benn
Senior Automation Engineer
Cenix BioScience
PfotenhauerStrasse 108
D-01307
Dresden
Germany
Tel : +49 (351) 210 1300
e-mail : (e-mail address removed)
Cenix Website :
http://www.cenix-bioscience.com