// gets the verifier
Verifier verifier = schema.newVerifier();
// set the error handler. This object receives validation errors.
// you can pass any class that implements org.sax.ErrorHandler.
verifier.setErrorHandler( new IgnoreErrorHandler() );
// use the verify method to validate documents.
// or you can validate SAX events by using the getVerifierHandler method.
if(verifier.verify(fileName))
System.out.println(fileName+" is valid");