doctype.entities.put(name, ids);
doctype.addEntityDecl(name, ids, inExternalSubset);
  private void readEntityDecl()    throws IOException, XMLStreamException  {    int flags = 0;    // Check if parameter entity    boolean peFlag = false;    expandPE = false;    requireWhitespace();    if (tryRead('%'))      {        peFlag = true;        requireWhitespace();      }    expandPE = true;    // Read entity name    String name = readNmtoken(true);    if (name.indexOf(':') != -1)      error("Illegal character ':' in entity name", name);    if (peFlag)      name = "%" + name;    requireWhitespace();    mark(1);    char c = readCh();    reset();    if (c == '"' || c == '\'')      {        // Internal entity replacement text        String value = readLiteral(flags);        doctype.entities.put(name, value);      }    else      {        ExternalIds ids = readExternalIds(false, false);        // Check for NDATA        boolean white = tryWhitespace();        if (!peFlag && tryRead("NDATA"))          {            if (!white)              error("whitespace required before NDATA");            requireWhitespace();            ids.notationName = readNmtoken(true);          }        doctype.entities.put(name, ids);      }    // finish    skipWhitespace();    require('>');  }