xml.sax module documentation

Martin von Loewis loewis at informatik.hu-berlin.de
Mon Nov 13 06:16:19 EST 2000


"Syver Enstad" <syver.enstad at sensewave.com> writes:

> Here's a little example that I wrote some weeks ago when I was in your
> situation:
> 
> 
> import xml.sax.handler
> 
> class HandlerBase(
>     xml.sax.handler.ContentHandler, xml.sax.handler.ErrorHandler,
>     xml.sax.handler.EntityResolver, xml.sax.handler.DTDHandler):
>     """Defines a helper class that you can derive from when
>     making handler classes to use with the sax parser"""

Hi Syver,

Thanks for the chance to let me comment on HandlerBase. I think it so
rarely (if ever) needed that it is not worth defining it. In your
specific example, all you need is a ContentHandler, so you only need
to inherit from that class.

> class FindIssue(HandlerBase):

Also, for convenience, ContentHandler is available through xml.sax, so
you should write

class FindIssue(xml.sax.ContentHandler):

This all is a minor point, but I thought I'd mention it anyway.

Regards,
Martin



More information about the Python-list mailing list