[Home] [By Thread] [By Date] [Recent Entries]
----- Original Message ----- From: "Elliotte Rusty Harold" <elharo@m...> To: "Karl Waclawek" <karl@w...> Cc: <xml-dev@l...>; <sax-devel@l...> Sent: Tuesday, March 09, 2004 10:27 AM > At 8:01 PM -0500 3/8/04, Karl Waclawek wrote: > > >> I'm not sure what this program is supposed to demonstrate. One of the > >> conclusions I think we're reaching is that if a client supplied > >> method such as startDocument() throws an exception, then endDocument > >> (and fatalError()) are not called. > > > I thought this when this discussion started, but I've been convinced > otherwise since then. There are just too many different exceptions a > client can throw for too many different reasons, including not only > SAXExceptions but many RuntimeExceptions and even errors, some of > which (ArrayIndexOutOfBoundsException, OutOfMemoryError) may be > unintentional and the result of program bugs. Or intentional exceptions based on application logic. The XML document may be well-formed and even valid, but from the client's point of view it could still be in error. > The model is cleaner > if the ErrorHandler is reserved for errors defined in the XML > specification. And according to the JavDoc, this is what it does now. > For the fatalError() method it says, "This corresponds to the > definition of 'fatal error' in section 1.2 of the W3C XML 1.0 > Recommendation. For example, a parser would use this callback to > report the violation of a well-formedness constraint." > > It doesn't say that fatalError cannot be called for other, client > generated exceptions, but there doesn't seem to be any text at all > indicating that they could be. Yes, I always thought that application erros should not be reported through the error handlers. I was just not sure if maybe the docs allowed or favoured it. So what is the agreement about EndDocument() now? I am not sure I got it. Is it as simple as this: endDocument() must always be called once startDocument() was called, even after a fatal error was reported, unless XMLReader.parse() returned with an exception. Would that be it? Karl
|

Cart



