SAX2: Exceptions

David Megginson david at
Tue Dec 21 18:44:14 GMT 1999

David Brownell writes:

 > David Megginson wrote:
 > > 
 > > 1. SAXException extends IOException.
 > Not my preferred model ... it _isn't_ an I/O exception, and the
 > recovery mechanisms applicable to I/O problems won't typically
 > apply, or even act reasonably given a data format error (which
 > is what a SAXException basically indicates).
 > What's the rationale behind this proposal?

Consider higher-level APIs that happen to allow XML input.  It seems
(to me, at least) that the following makes sense:

  public interface Gizmo
    public void import (String uri) throws IOException;

You don't want to hardwire SAXException into the Gizmo interface,
because it really has nothing to do with the problem domain, and
people may choose to implement other kinds of readers (say, over the
DOM); you could, of course, create a new kind of IOException that
allows a SAXException to be embedded in it, but that hides the fact
that an XML parsing error really is an I/O error for most
applications -- XML's just a high-level read format.

All the best,


David Megginson                 david at

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list