[Expat-discuss] Abort parsing from inside an handler?

Fred L. Drake, Jr. fdrake at acm.org
Tue Oct 28 17:41:17 EST 2003


Régis St-Gelais writes:
 > So my question is: is there a way to abort the parsing from inside an
 > handler?

Unfortunately, no.  This is a specific goal for Expat 3.0 however.

What you can do in the current version, in addition to setting a flag,
is to clear all the handlers *except* the external entity reference
handler.  This handler should be set to something that always
indicates an error occurred, and XML_SetParamEntityParsing() should be
called with XML_PARAM_ENTITY_PARSING_ALWAYS (unless you're already in
the document body, since it makes no sense then), so that Expat will
exit as quickly as possible.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation



More information about the Expat-discuss mailing list