[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Expat question

From: Greg Stein <gstein_at_lyra.org>
Date: 2000-08-09 14:51:57 CEST

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/
Received on Sat Oct 21 14:36:06 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.