code: public static Document parse(String xml, boolean validation) throws IOException, SAXException, IllegalArgumentException {
          // if validation is on, we need to add headers
          if (validation) {
              xml = MathDoc.fixingHeaderAndNS(xml);
          }
  
          InputSource src = stringToSource(xml);
  
          if (validation) {
              return ValidationBuilder.parse(src);
          } else {
              return NoValidationBuilder.parse(src);
          }
      }
docs: Parses XML to a W3C Document object with activated or deactivated validation.
  In case of validation, a correct header is needed. Therefore, we try to fix the
  header before we try to parse the input. Also, an error handler is activated
  that throws {@link SAXException} if an error due the validation or parsing process
  will be thrown.
  <p>
  In case of deactivated validation, there will be no SAXException occur!
  
  @param xml        in string format
  @param validation turn validation on or off
  @return Document of XML object.
  @throws IOException              if an IO error occurs
  @throws SAXException             only occurs when validation is on and an error due parsing the document occurred.
  @throws IllegalArgumentException if the argument is null