private void processDocType() throws Exception {
    if (!XMLUtil.checkLiteral(reader, "OCTYPE")) {
      XMLUtil.errorExpectedInput(reader.getSystemID(), reader.getLineNr(), "<!DOCTYPE");
      return;
    }

    XMLUtil.skipWhitespace(reader, null);
    String systemID = null;
    StringBuilder publicID = new StringBuilder();
    String rootElement = XMLUtil.scanIdentifier(reader);
    XMLUtil.skipWhitespace(reader, null);
    char ch = reader.read();

    if (ch == 'P') {
      systemID = XMLUtil.scanPublicID(publicID, reader);
      XMLUtil.skipWhitespace(reader, null);
      ch = reader.read();
    }
    else if (ch == 'S') {
      systemID = XMLUtil.scanSystemID(reader);
      XMLUtil.skipWhitespace(reader, null);
      ch = reader.read();
    }

    if (ch == '[') {
      validator.parseDTD(publicID.toString(), reader, entityResolver, false);
      XMLUtil.skipWhitespace(reader, null);
      ch = reader.read();
    }

    if (ch != '>') {
      XMLUtil.errorExpectedInput(reader.getSystemID(), reader.getLineNr(), "`>'");
    }

    if (systemID != null) {
      Reader reader = this.reader.openStream(publicID.toString(), systemID);
      this.reader.startNewStream(reader);
      this.reader.setSystemID(systemID);
      this.reader.setPublicID(publicID.toString());
      validator.parseDTD(publicID.toString(), this.reader, entityResolver, true);
    }
  }
private void processDocType()