Anonymous user
XML validation: Difference between revisions
m
→{{header|Java}}: Tidy up
(→Java: Added implementation) |
m (→{{header|Java}}: Tidy up) |
||
Line 52:
public class XmlValidation {
public static void main(String... args) throws MalformedURLException
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) {
System.out.println("warning: " + exception.getMessage());
}
@Override
public void error(SAXParseException exception) {
System.out.println("error: " + exception.getMessage());
valid.value = false;
Line 84 ⟶ 81:
@Override
public void fatalError(SAXParseException exception) throws SAXException {
System.out.println("fatal error: " + exception.getMessage());
throw exception;
|