{ char x = ref[i]; if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0 && (x == 0x0a || x == 0x0d)) x = 0x20; else if ((flags & LIT_ATTRIBUTE) != 0 && x == 0x09) x = 0x20; literalBuf.append(x); }
literalBuf.append(ref[i]);
  private String readLiteral(int flags, boolean recognizePEs)    throws IOException, XMLStreamException  {    boolean saved = expandPE;    int delim = readCh();    if (delim != 0x27 && delim != 0x22)      error("expected '\"' or \"'\"", "U+" + Integer.toHexString(delim));    literalBuf.setLength(0);    if ((flags & LIT_DISABLE_PE) != 0)      expandPE = false;    boolean entities = false;    int inputStackSize = inputStack.size();    do      {        int c = literalReadCh(recognizePEs);        if (c == delim && inputStackSize == inputStack.size())          break;        switch (c)          {          case 0x0a:          case 0x0d:            if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0)              c = 0x20; // normalize to space            break;          case 0x09:            if ((flags & LIT_ATTRIBUTE) != 0)              c = 0x20; // normalize to space            break;          case 0x26: // '&'            mark(2);            c = readCh();            if (c == 0x23) // '#'              {                if ((flags & LIT_DISABLE_CREF) != 0)                  {                    reset();                    c = 0x26; // '&'                  }                else                  {                mark(1);                c = readCh();                    boolean hex = (c == 0x78); // 'x'                if (!hex)                  reset();                char[] ref = readCharacterRef(hex ? 16 : 10);                for (int i = 0; i < ref.length; i++)                  {                        char x = ref[i];                    if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0 &&                            (x == 0x0a || x == 0x0d))                          x = 0x20; // normalize                        else if ((flags & LIT_ATTRIBUTE) != 0 && x == 0x09)                          x = 0x20; // normalize                        literalBuf.append(x);                  }                entities = true;                continue;              }              }            else              {                if ((flags & LIT_DISABLE_EREF) != 0)                  {                    reset();                    c = 0x26; // '&'                  }                else                  {                reset();                    String entityName = readNmtoken(true);                    require(';');                        String text =                          (String) PREDEFINED_ENTITIES.get(entityName);                    if (text != null)                          literalBuf.append(text);                    else                          expandEntity(entityName,                                   (flags & LIT_ATTRIBUTE) != 0,                                   true);                    entities = true;                    continue;                  }              }            break;          case 0x3c: // '<'            if ((flags & LIT_ATTRIBUTE) != 0)              error("attribute values may not contain '<'");            break;          case -1:            if (inputStack.size() > 1)              {                popInput();                continue;          }            throw new EOFException();          default:            if ((c < 0x0020 || c > 0xfffd) ||                (c >= 0xd800 && c < 0xdc00) ||                (input.xml11 && (c >= 0x007f) &&                 (c <= 0x009f) && (c != 0x0085)))              error("illegal character", "U+" + Integer.toHexString(c));      }        literalBuf.append(Character.toChars(c));      }    while (true);    expandPE = saved;    if (entities)      normalizeCRLF(literalBuf);    if ((flags & LIT_NORMALIZE) > 0)      literalBuf = normalize(literalBuf);    return literalBuf.toString();  }