[Expat-discuss] Stopping the parse
Scott Bronson
bronson@rinspin.com
Wed, 18 Apr 2001 11:32:51 -0700
On Wed, Apr 18, 2001 at 01:38:03PM -0400, Fred L. Drake, Jr. wrote:
> Here's a (slightly) better approach that we use in the Python
> bindings for Expat: when a Python handler raises an exception, we
> clear all the handlers registered with the parser instance being used.
> This avoids having to check a flag for each callback (which gives us
> more maintainable application code), and can be just a little faster.
This sounds like a good approach. I'll use it. Thanks, Fred.
I just need to be sure that if Expat finds a syntax error later in
the file, that doesn't mask the "real" error I hit earlier on.
- Scott
p.s. This gives me another idea for how to stop expat:
buf = XML_GetBuffer(parser, buf_len)
XML_ParseBuffer(parser, buf_len, 0)
then, from a callback...
bzero(buf, buf_len);
:)