- From: by way of <lane@mcs.anl.gov>
- Date: Thu, 03 Oct 2002 06:23:45 -0600
- To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>
Jimmy, I was having this same problem and eventually figured something out that works. I think what's going on is that validation *is* happening when the schema is found, but the errors are not being propegated to the program using the parser. The way I solved this was to use the parser's setErrorHandler() method, and pass an intance of the ErrorHandler interface which relays the errors to my code: DOMParser xmlParser = new DOMParser(); xmlParser.setFeature("http://xml.org/sax/features/validation", true); xmlParser.setErrorHandler(new MyErrorHandler()); ... public class MyErrorHandler implements ErrorHandler { ... public void error(SAXParserException saxpe) { System.error.println(saxpe.getMessage()); //or whatever } ... } This seems kind of silly, IMHO, but it works for me. Peter
Received on Thursday, 3 October 2002 08:35:27 UTC