I submitted a patch for this on 2/1 but it was bundled with 2 other more controversial patches and never got applied. A standalone patch to remove the try/catch blocks is appended.
george -----Original Message----- From: Andy Clark [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 23, 2000 6:51 PM To: [EMAIL PROTECTED] Subject: Re: [Xerces-J] XMLSchemaValidator and errors.... [EMAIL PROTECTED] wrote: > exceptions to be thrown from the parser's parse() method. The result, > however, is that the XMLSchemaValidator catches it in the loadSchema() > method, and prints out the stack trace. Is this really the desirable You are completely correct, this should be changed. Our schema support at the moment it experimental but in the final implementation errors in loading the schema should be reported through the error handler registed on the parser. -- Andy Clark * IBM, JTC - Silicon Valley * [EMAIL PROTECTED] diff -u XSchemaValidator.bak XSchemaValidator.java --- XSchemaValidator.bak Mon Feb 07 22:11:00 2000 +++ XSchemaValidator.java Thu Feb 24 10:29:00 2000 @@ -1658,7 +1658,7 @@ private DOMParser fSchemaParser = null; - public void loadSchema(InputSource is) { + public void loadSchema(InputSource is) throws Exception{ // create parser for schema if (fSchemaParser == null) { @@ -1670,38 +1670,12 @@ fSchemaParser.setErrorHandler(new ErrorHandler()); } - // parser schema file - try { - - fSchemaParser.setFeature("http://xml.org/sax/features/validation", true); - fSchemaParser.setFeature("http://apache.org/xml/features/dom/defer-node-expansio n", false); - fSchemaParser.parse(is); - } - catch (SAXException se) { - se.getException().printStackTrace(); - System.err.println("error parsing schema file"); -// System.exit(1); - } - catch (Exception e) { - e.printStackTrace(); - System.err.println("error parsing schema file"); -// System.exit(1); - } + fSchemaParser.setFeature("http://xml.org/sax/features/validation", true); + fSchemaParser.setFeature("http://apache.org/xml/features/dom/defer-node-expansio n", false); + fSchemaParser.parse(is); fSchemaDocument = fSchemaParser.getDocument(); - if (fSchemaDocument == null) { - System.err.println("error: couldn't load schema file!"); - return; - } - - // traverse schema - try { - Element root = fSchemaDocument.getDocumentElement(); - traverseSchema(root); - } - catch (Exception e) { - e.printStackTrace(System.err); -// System.exit(1); - } + Element root = fSchemaDocument.getDocumentElement(); + traverseSchema(root); } private void traverseSchema(Element root) throws Exception {