protected EntityDecl resolveNonCharEntity()
        throws XMLStreamException
    {
        //int avail = inputInBuffer();
        int avail = mInputEnd - mInputPtr;
        if (avail < 6) {
            // split entity, or buffer boundary
            /* Don't want to lose leading '&' (in case we can not expand
             * the entity), so let's push it back first
             */
            --mInputPtr;

            /* Shortest valid reference would be 3 chars ('&a;'); which
             * would only be legal from an expanded entity...
             */
            if (!ensureInput(6)) {
                avail = inputInBuffer();
                if (avail < 3) {
                    throwUnexpectedEOF(SUFFIX_IN_ENTITY_REF);
                }
            } else {
                avail = 6;
            }
            // ... and now we can move pointer back as well:
            ++mInputPtr;
        }

        // We don't care about char entities:
        char c = mInputBuffer[mInputPtr];
        if (c == '#') {
            return null;
        }

        /* 19-Aug-2004, TSa: Need special handling for pre-defined
         *   entities; they are not counted as 'real' general parsed
         *   entities, but more as character entities...
         */

        // have chars at least up to mInputPtr+4 by now
        if (c == 'a') {
            char d = mInputBuffer[mInputPtr+1];
            if (d == 'm') {
                if (avail >= 4
                    && mInputBuffer[mInputPtr+2] == 'p'
                    && mInputBuffer[mInputPtr+3] == ';') {
                    // If not automatically expanding:
                    //return sEntityAmp;
                    // mInputPtr += 4;
                    return null;
                }
            } else if (d == 'p') {
                if (avail >= 5
                    && mInputBuffer[mInputPtr+2] == 'o'
                    && mInputBuffer[mInputPtr+3] == 's'
                    && mInputBuffer[mInputPtr+4] == ';') {
                    return null;
                }
            }
        } else if (c == 'l') {
            if (avail >= 3
                && mInputBuffer[mInputPtr+1] == 't'
                && mInputBuffer[mInputPtr+2] == ';') {
                return null;
            }
        } else if (c == 'g') {
            if (avail >= 3
                && mInputBuffer[mInputPtr+1] == 't'
                && mInputBuffer[mInputPtr+2] == ';') {
                return null;
            }
        } else if (c == 'q') {
            if (avail >= 5
                && mInputBuffer[mInputPtr+1] == 'u'
                && mInputBuffer[mInputPtr+2] == 'o'
                && mInputBuffer[mInputPtr+3] == 't'
                && mInputBuffer[mInputPtr+4] == ';') {
                return null;
            }
        }

        // Otherwise, let's just parse in generic way:
        ++mInputPtr; // since we already read the first letter
        String id = parseEntityName(c);
        mCurrName = id;

        return findEntity(id, null);
    }
protected EntityDecl resolveNonCharEntity ( ) throws XMLStreamException { int avail = mInputEnd - mInputPtr ; if ( avail < 6 ) { -- mInputPtr ; if ( ! ensureInput ( 6 ) ) { avail = inputInBuffer ( ) ; if ( avail < 3 ) { throwUnexpectedEOF ( SUFFIX_IN_ENTITY_REF ) ; } } else { avail = 6 ; } ++ mInputPtr ; } char c = mInputBuffer [ mInputPtr ] ; if ( c == '#' ) { return null ; } if ( c == 'a' ) { char d = mInputBuffer [ mInputPtr + 1 ] ; if ( d == 'm' ) { if ( avail >= 4 && mInputBuffer [ mInputPtr + 2 ] == 'p' && mInputBuffer [ mInputPtr + 3 ] == ';' ) { return null ; } } else if ( d == 'p' ) { if ( avail >= 5 && mInputBuffer [ mInputPtr + 2 ] == 'o' && mInputBuffer [ mInputPtr + 3 ] == 's' && mInputBuffer [ mInputPtr + 4 ] == ';' ) { return null ; } } } else if ( c == 'l' ) { if ( avail >= 3 && mInputBuffer [ mInputPtr + 1 ] == 't' && mInputBuffer [ mInputPtr + 2 ] == ';' ) { return null ; } } else if ( c == 'g' ) { if ( avail >= 3 && mInputBuffer [ mInputPtr + 1 ] == 't' && mInputBuffer [ mInputPtr + 2 ] == ';' ) { return null ; } } else if ( c == 'q' ) { if ( avail >= 5 && mInputBuffer [ mInputPtr + 1 ] == 'u' && mInputBuffer [ mInputPtr + 2 ] == 'o' && mInputBuffer [ mInputPtr + 3 ] == 't' && mInputBuffer [ mInputPtr + 4 ] == ';' ) { return null ; } } ++ mInputPtr ; String id = parseEntityName ( c ) ; mCurrName = id ; return findEntity ( id , null ) ; }
Reverse of {@link #resolveCharOnlyEntity}; will only resolve entity
if it is NOT a character entity (or pre-defined 'generic' entity;
amp, apos, lt, gt or quot). Only used in cases where entities
are to be separately returned unexpanded (in non-entity-replacing
mode); which means it's never called from dtd handler.