Lists Home |
Date Index |
----- Original Message -----
From: "Jeff Rafter" <email@example.com>
To: "Karl Waclawek" <firstname.lastname@example.org>; <email@example.com>
Sent: Friday, February 27, 2004 2:54 PM
> > To me this would also mean that any exceptions thrown
> > should stop the parser without calling endDocument(), as
> > an exception is certainly a stronger error condition than
> > a fatalError() call-back that does not throw an exception.
> I would be a little more open about it. I would say that because it "may"
> continue passing events, it is optional either way. With that being said, I
> think that guaranteeing endDocument for the purpose of cleanup is useful-- I
> just can't find it anywhere explicit.
For cleanup - especially for a chain of SAX filters, one problem is
that when parsing stops due to an exception, that the processors
down the chain will not know if the stop was due to an error or not,
as they will know nothing about the exception.
What about this then:
- Add an error argument to endDocument, like in
public void endDocument(SAXParseException exception)
which can be null.
- Require endDocument to be called even in case of a call-back
exception, and have its argument wrap that exception.
This could even replace the fatalError call-back, unless
a parser wants to continue reporting (but what? - isn't
that contrary to the definition fatal error?).
IMO, guaranteeing the call to endDocument() without
the ability to pass information about the reason/status
severely limits the usefulness of that guarantee.