code: public boolean validate(InputSource in) throws SAXException, IOException {
      if (schema == null)
        throw new IllegalStateException("cannot validate without schema");
      if (validator == null)
        validator = schema.createValidator(instanceProperties);
      if (xr == null) {
        xr = ResolverFactory.createResolver(instanceProperties).createXMLReader();
        xr.setErrorHandler(eh);
      }
      eh.reset();
      xr.setContentHandler(validator.getContentHandler());
      DTDHandler dh = validator.getDTDHandler();
      if (dh != null)
        xr.setDTDHandler(dh);
      try {
        xr.parse(in);
        return !eh.getHadErrorOrFatalError();
      }
      finally {
        validator.reset();
      }
    }
docs: Validates a document against the currently loaded schema. This can be called
  multiple times in order to validate multiple documents.
  
  @param in the InputSource for the document to be validated
  @return <code>true</code> if the document is valid; <code>false</code> otherwise
  @throws java.lang.IllegalStateException if there is no currently loaded schema
  @throws java.io.IOException if an I/O error occurred
  @throws org.xml.sax.SAXException if an XMLReader or ErrorHandler threw a SAXException