[XML-SIG] Sgmlop SAX 2 parser
Lars Marius Garshol
larsga@garshol.priv.no
26 Jul 2001 10:18:24 +0200
Hi Alexandre,
* Alexandre Fayolle
|
| Here's a first version of my attempt at providing a SAX2 parser for
| Sgmlop. It still features some debugging prints. I'd be very grateful if
| you could scrutinize it hard and tell me what you think of it. I'll be
| back online on Monday.
This looks reasonable to me. I haven't tested it, or looked at what it
does with encodings, but the general approach seems like it will work
just fine.
Some minor nits:
- set_property should be setProperty
- you don't need prepareParser, it's just there to make subclassing
IncrementalParser easier, but you don't do that
- I think you omit the startDocument() element if someone only uses
the feed, close, and reset methods, without going via parse
- the experimental Python extensions you can just remove, that is
stuff from SAX 1.0
- the SaxHtmlParser looks good, but it should get its own module so
that it is accessible via xml.sax.make_parser
BTW: I needed HTML parsing yesterday, and, forgetting Alexandre's
contribution, I added drivers for sgmllib and htmllib to
xml.sax.drivers2. So we should be well covered in terms of SGML
and HTML parsing now.
--Lars M.