OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] SAX - endDocument() confusion again

[ Lists Home | Date Index | Thread Index ]


----- Original Message ----- 
From: "Jeff Rafter" <lists@jeffrafter.com>
To: "Karl Waclawek" <karl@waclawek.net>; <xml-dev@lists.xml.org>
Cc: <sax-devel@lists.sourceforge.net>
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)
                throws SAXException

  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.

Karl







 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS