[XML-SIG] How to stop parser

Fred L. Drake, Jr. fdrake@acm.org
Tue, 10 Dec 2002 10:33:15 -0500

Remy C. Cool writes:
 > Warnings, errors and fatalErrors are handled by my own defined 
 > functions in the parser. They append the warning/error to a list 
 > which can be read by the main program when the parser returns.  How 
 > can I raise an SAXException so that the parser will return without 
 > halting the program ? 

Raise the exception in your handler using a raise statement, then
catch it using a try/except statement where you call the parser.  Your
application can then examine the accululated state as it sees fit.


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