Re: HTML::Parser: document events

Gisle Aas (gisle@activestate.com)
11 Mar 2001 15:48:11 -0800


Bjoern Hoehrmann <derhoermi@gmx.net> writes:

> I suggest to introduce two new events for HTML::Parser:
> 
>   * init: raised when parse() is called the first time
>   * eof: raised when eof() was called or parse_file() finishes
> 
> This improves compatibility with other APIs like SAX or SAC.

Seems like a possibility.  Some questions:

It there a real techincal reason for this? What kind of tasks become
easier with this addition?

The return value from XML::Parser's Final handler is used as the
return value from the parse method.  Do you want your 'eof' to have a
similar effect?

Should the default handler be invoked for the 'init' and 'eof' events?
Will that break older code?

If you feed new stuff to the parser after 'eof', do you want 'init' to
be called again.

Regards,
Gisle