code: private void validateByRules(InputStream objectAsStream,
                                   String ruleSchemaPath,
                                   String preprocessorPath,
                                   String phase) throws ObjectValidityException,
              GeneralException {
  
          try {
              DOValidatorSchematron schtron =
                      new DOValidatorSchematron(ruleSchemaPath,
                                                preprocessorPath,
                                                phase);
              schtron.validate(objectAsStream);
          } catch (ObjectValidityException e) {
              logger.error("VALIDATE: ERROR - failed Schematron rules validation.",
                        e);
              throw e;
          } catch (Exception e) {
              logger.error("VALIDATE: ERROR - failed Schematron rules validation.",
                        e);
              throw new ObjectValidityException("[DOValidatorImpl]: "
                      + "failed Schematron rules validation. " + e.getMessage());
          }
          logger.debug("VALIDATE: SUCCESS - passed Schematron rules validation.");
      }
docs: Do Schematron rules validation on the Fedora object. Schematron
  validation tests the object against a set of rules expressed using XPATH
  in a Schematron schema. These test for things that are beyond what can be
  expressed using XML Schema.
  
  @param objectAsFile
  The digital object provided as a file.
  @param schemaPath
  Location of the Schematron rules file.
  @param preprocessorPath
  Location of Schematron preprocessing stylesheet
  @param phase
  The workflow phase (ingest, store) for the object.
  @throws ObjectValidityException
  If validation fails for any reason.
  @throws GeneralException
  If validation fails for any reason.