You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Karl Fogel <kf...@galois.collab.net> on 2000/08/09 03:00:35 UTC

Expat question

Anyone experienced with the Expat parser (subversion/expat-lite/)?

The question of the hour is:

If Expat invokes one of our callbacks during the parse, and the
callback encounters some error situation and decides there's no point
in continuing parsing, does Expat provide some way to just return
immediately from the parse with error (i.e., make that call to
XML_Parse() return immediately)?

Or do we need to set a jump buffer outside XML_Parse() and long_jmp
out of the callback?

Re: Expat question

Posted by Greg Stein <gs...@lyra.org>.
On Tue, Aug 08, 2000 at 10:00:35PM -0500, Karl Fogel wrote:
> Anyone experienced with the Expat parser (subversion/expat-lite/)?
> 
> The question of the hour is:
> 
> If Expat invokes one of our callbacks during the parse, and the
> callback encounters some error situation and decides there's no point
> in continuing parsing, does Expat provide some way to just return
> immediately from the parse with error (i.e., make that call to
> XML_Parse() return immediately)?

Nope.

You may note that util_xml.c in Apache has the following lines at the start
of each handler:

    /* punt once we find an error */
    if (ctx->error)
        return;

Another approach (used by Python's Expat interface) is to clear all the
handlers when an error occurs. Just call (say) XML_SetElementHandler() with
a couple NULL values.

> Or do we need to set a jump buffer outside XML_Parse() and long_jmp
> out of the callback?

I would *never* recommend the use of setjmp/longjmp. You never know what
kinds of resources have been allocated. Jumping across a third-party library
is just Bad Juju.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/