You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Jo...@lotus.com on 2001/05/16 17:29:10 UTC

SAX ErrorHandler behavior question

This is a moderately subtle point, and I'm honestly not sure whether it's a
SAX issue or a Xerces issue...

I have a situation where I need to know whether a SAX stream has been
terminated due to an exception thrown by the ContentHandler, in order to
perform some clean-up (thread termination and so on). Normally I'd just
wrap a try/catch around the myXMLReader.parse() call... but this is a
situation where that call is happening outside my own code; I'm just
configuring assembling and returning the handler object, and it's being
registered and invoked elsewhere.

I was hoping that this case would be reported to the ErrorHandler as a
fatalError(). But that doesn't seem to be happening, at least in the
version of Xerces I'm currently using -- the error(), fatalError(), and
warning() methods are not being invoked when my ContentHandler deliberately
throws an exception.

This is particularly important to me because throwing an exception from the
ContentHandler is the only portable mechanism SAX provides for saying "I
don't need the rest of the file, you can stop now" -- which could make a
real performance difference versus finishing the parse, in some
circumstances.


So:

Is this failure to report the ContentHandler's exception a bug in how
Xerces is handling exceptions,  is it a bug in SAX2's design, or is a
fringe case where SAX2 permits either calling ErrorHandler or not?

And if it's a bug, how quickly can we get a fix? It's blocking progress on
one of the things we're trying to do with the new Xalan DTM code -- in
particular, it means we never conduct the coroutine shutdown dialog when
run in that mode -- and we're trying to push this out the door in a hurry.


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org