private void readDocTypeDecl() throws ParseException, IOException {
    readSymbol(DOCTYPE_BEGIN);
    readS();
    docTypeName_ = readName();
    if (isS()) {
      //either at (1) or (2)
      readS();
      if (!isChar('>') && !isChar('[')) {
        //was at (1)
        isExternalDtd_ = true; //less checking of entity references
        readExternalId();
        //now at (2)
        if (isS()) readS();
      }
    }
    //now at (3)
    if (isChar('[')) {
      readChar();
      while (!isChar(']')) {
        if (isDeclSep())
          readDeclSep();
        else
          readMarkupDecl();
      }
      readChar(']');
      if (isS()) readS();
    }
    readChar('>');
  }