code: public void validate() {
      Validator validator = this.schema.newValidator();
      InputStream in = null;
      try {
        if(this.xmlFile != null) {
          in = this.xmlFile.openStream();
        } else {
          // TODO: check if we need to specify the encoding
          in = new ByteArrayInputStream(this.serializedRule.getBytes()) ;
        }
        validator.validate(new StreamSource(in));
      } catch (SAXException e) {
        throw new RulesException("Rules file does not conform to the schema", e);
      } catch (IOException e) {
        if(this.xmlFile != null) {
          throw new RulesException("Could not read file " + this.xmlFile, e);
        } else {
          throw new RulesException("Could not read serialized rule " + this.serializedRule, e);
        }
          
      } finally {
        Closeables.closeQuietly(in);
      }
    }
docs: Checks the xml against the xsd.