XML validation: Difference between revisions

m
(→‎Java: Added implementation)
Line 52:
 
public class XmlValidation {
public static void main(String... args) throws MalformedURLException, {
SAXException {
URL schemaLocation = new URL("http://venus.eas.asu.edu/WSRepository/xml/Courses.xsd");
URL documentLocation = new URL("http://venus.eas.asu.edu/WSRepository/xml/Courses.xml");
Line 71 ⟶ 70:
validator.setErrorHandler(new ErrorHandler(){
@Override
public void warning(SAXParseException exception) {
throws SAXException {
System.out.println("warning: " + exception.getMessage());
}
 
@Override
public void error(SAXParseException exception) {
throws SAXException {
System.out.println("error: " + exception.getMessage());
valid.value = false;
Line 84 ⟶ 81:
 
@Override
public void fatalError(SAXParseException exception) throws SAXException {
throws SAXException {
System.out.println("fatal error: " + exception.getMessage());
throw exception;
Anonymous user