code: Document parse(Document doc, Element instruction, PrintWriter logger)
              throws Exception {
          this.outputLogger = logger;
          if (instruction != null) {
              getFileType(instruction);
              if (type.equals("url")) {
                  URL schemaURL = new URL(this.schemaLocation);
                  this.schemaFile = new File(schemaURL.toURI());
              } else if (type.equals("file")) {
                  this.schemaFile = new File(this.schemaLocation);
              } else if (type.equals("resource")) {
                  URL url = this.getClass().getResource(this.schemaLocation);
                  this.schemaFile = new File(URLDecoder.decode(url.getFile(),
                          "UTF-8"));
              }
          }
          boolean isValid = false;
          if (doc != null) {
              InputSource xmlInputSource = null;
              try {
                  InputStream inputStream = DocumentToInputStream(doc);
                  xmlInputSource = new InputSource(inputStream);
              } catch (IOException e) {
                  e.printStackTrace();
              }
              isValid = executeSchematronDriver(xmlInputSource, this.schemaFile,
                      this.phase);
          }
          if (!isValid) {
              return null;
          } else {
              return doc;
          }
      }
docs: Checks the given Document against a Schematron schema. A schema reference
  is conveyed by a DOM Element node as indicated below.
  
  <pre>
  {@code
  <tep:schemas xmlns:tep="http://www.occamlab.com/te/parsers">
  <tep:schema type="resource" phase="#ALL">/class/path/schema1.sch</tep:schema>
  </tep:schemas>
  }
  </pre>
  
  @param doc
  The document to be validated.
  @param instruction
  An Element containing schema information.
  @param logger
  A Writer used for logging error messages.
  @return The valid document, or {@code null} if any errors were detected.
  @throws Exception