code: public static Document parse(File file, boolean validation) throws IOException, SAXException, IllegalArgumentException {
          if (validation) {
              try {
                  return ValidationBuilder.parse(file);
              } catch (SAXException saxe) {
                  LOG.debug("Parsing exception occur. It's most likely a wrong header. Try to fixing it...");
                  String str = new String(Files.readAllBytes(file.toPath()), Charsets.UTF_8);
                  return parse(str, validation);
              }
          } else {
              return NoValidationBuilder.parse(file);
          }
      }
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 file       XML
  @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