> -----Original Message----- > From: Peter B. West [mailto:[EMAIL PROTECTED]
> Would anyone expect that Defoe would > subclass SAXException for document validation errors? If not (it > doesn't), why not? Yes, if you use a SAX parser, why not? My point is that at the top-level, no SAXExceptions should be thrown (or a subclass from SAXException) since these could be caught by a higher-level catch-block for SAXExceptions, leading to all sorts of unpleasant surprises or incomprehensible error messages. Could be that the Exception really has its roots in the SAX parser, but FOP/Defoe isn't purely about SAX --FOP just happens to use SAX to parse the XML. There's also at least layout and rendering where errors can occur (esp. if we strive for pluggable layoutmanagers or renderers --could easily lead to misconfigurations that might surface only when the app actually tries to layout/render something, so when the XML parsing is already well under way...) What FOP or Defoe does within the context of their own packag(es) doesn't really matter so long as it's properly documented in the JavaDocs, but for an end-user --whether command-line or embedded-- the error should IMO definitely indicate that the error comes from within FOP/Defoe, which is not the case when you just hand off a SAXException or one of its subclasses. (Same goes for FileNotFoundExceptions... Very tempting to use this for all cases where 'a file cannot be found', but in case we use it in FOP, it should come out wrapped in a FOPException --XSL processors would also report this as i.e. a TransformerException, caused by a lower-level FNFE. Users who know their way in Java would associate an FNFE with particular types of classes and operations that clearly indicate that a reference to a File is created. With FOP or Defoe the creation of these file-references is shielded from the end-users, so it would turn out to be confusing to throw FNFEs at them...) > And if someone was inclined to write an FO processor > using a DOM front-end, would you expect validation errors to throw > subclasses of SAXException? Very, very good point indeed! The answer, of course, is no. Should IMO be at least a form of DOMException. Greetz, Andreas