if (!isNameCharacter(cp[i]))
if (!isNameCharacter(cp[i], input.xml11))
  private void readEntityDecl(boolean inExternalSubset)    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);    int c = readCh();    reset();    if (c == 0x22 || c == 0x27) // " | '      {        // Internal entity replacement text        String value = readLiteral(flags | LIT_DISABLE_EREF, true);        int ai = value.indexOf('&');        while (ai != -1)          {            int sci = value.indexOf(';', ai);            if (sci == -1)              error("malformed reference in entity value", value);            String ref = value.substring(ai + 1, sci);            int[] cp = UnicodeReader.toCodePointArray(ref);            if (cp.length == 0)              error("malformed reference in entity value", value);            if (cp[0] == 0x23) // #              {                if (cp.length == 1)                  error("malformed reference in entity value", value);                if (cp[1] == 0x78) // 'x'                  {                    if (cp.length == 2)                      error("malformed reference in entity value", value);                    for (int i = 2; i < cp.length; i++)                      {                        int x = cp[i];                        if (x < 0x30 ||                            (x > 0x39 && x < 0x41) ||                            (x > 0x46 && x < 0x61) ||                            x > 0x66)                          error("malformed character reference in entity value",                                value);                      }                  }                else                  {                    for (int i = 1; i < cp.length; i++)                      {                        int x = cp[i];                        if (x < 0x30 || x > 0x39)                          error("malformed character reference in entity value",                                value);                      }                  }              }            else              {                if (!isNameStartCharacter(cp[0]))                  error("malformed reference in entity value", value);                for (int i = 1; i < cp.length; i++)                  {                    if (!isNameCharacter(cp[i]))                      error("malformed reference in entity value", value);                  }              }            ai = value.indexOf('&', sci);          }        doctype.addEntityDecl(name, value, inExternalSubset);      }    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.addEntityDecl(name, ids, inExternalSubset);      }    // finish    skipWhitespace();    require('>');  }