import org.apache.xerces.parsers.DOMParser;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
public class SchemaParserXerces implements ErrorHandler {
public void warning(SAXParseException e) throws SAXException {
throw e;
}
public void error(SAXParseException e) throws SAXException {
throw e;
}
public void fatalError(SAXParseException e) throws SAXException {
throw e;
}
public static void main(String[] args) throws Exception {
DOMParser d = new DOMParser();
d.setFeature("http://xml.org/sax/features/validation", true);
d.setFeature("http://apache.org/xml/features/validation/schema", true);
d.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
d.setErrorHandler(new SchemaParserXerces());
d.parse(args[0]);
System.out.println("Parsed successfully");
}
}