private void readEntityDecl() throws ParseException, IOException {
    readSymbol(ENTITY_BEGIN);
    readS();
    if (isChar('%')) {
      readChar('%');
      readS();
      String name = readName();
      readS();
      String value;
      if (isEntityValue())
        value = readEntityValue();
      else
        value = readExternalId();
      pes_.put(name, value);
    } else {
      String name = readName();
      readS();
      String value;
      if (isEntityValue())
        value = readEntityValue();
      else if (isExternalId()) {
        value = readExternalId();
        if (isS()) readS();
        if (isSymbol(NDATA)) {
          readSymbol(NDATA);
          readS();
          readName();
        }
      } else
        throw new ParseException(this,
            "expecting double-quote, \"PUBLIC\" or \"SYSTEM\" while reading entity declaration");
      entities_.put(name, value);
    }
    if (isS()) readS();
    readChar('>');
  }