@Override
    protected EntityDecl findEntity(String id, Object arg)
    {
        // Expand a Parameter Entity?
        if (arg == ENTITY_EXP_PE) { // for attribute default
            EntityDecl ed = (mPredefdPEs == null) ? null : mPredefdPEs.get(id);
            if (ed != null) { // Entity from int. subset...
                mUsesPredefdEntities = true;
                /* No need to further keep track of internal references,
                 * since this subset can not be cached, so let's just free
                 * up Map if it has been created
                 */
                mRefdPEs = null;
            } else if (mParamEntities != null) {
                ed = mParamEntities.get(id);
                if (ed != null) {
                    if (!mUsesPredefdEntities) {
                        // Let's also mark down the fact we referenced the entity:
                        Set<String> used = mRefdPEs;
                        if (used == null) {
                            mRefdPEs = used = new HashSet<String>();
                        }
                        used.add(id);
                    }
                }
            }
            return ed;
        }

        // Nope, General Entity (within attribute default value)?
        if (arg == ENTITY_EXP_GE) {
            /* This is only complicated for external subsets, since
             * they may 'inherit' entity definitions from preceding
             * internal subset...
             */
            EntityDecl ed = (mPredefdGEs == null) ? null : mPredefdGEs.get(id);
            if (ed != null) {
                mUsesPredefdEntities = true;
                /* No need to further keep track of references,
                 * as this means this subset is not cachable...
                 * so let's just free up Map if it has been created
                 */
                mRefdGEs = null;
            } else if (mGeneralEntities != null) {
                ed = mGeneralEntities.get(id);
                if (ed != null) {
                    // Ok, just need to mark reference, if we still care:
                    if (!mUsesPredefdEntities) {
                        // Let's also mark down the fact we referenced the entity:
                        if (mRefdGEs == null) {
                            mRefdGEs = new HashSet<String>();
                        }
                        mRefdGEs.add(id);
                    }
                }
            }
            return ed;
        }

        throw new IllegalStateException(ErrorConsts.ERR_INTERNAL);
    }
@ Override protected EntityDecl findEntity ( String id , Object arg ) { if ( arg == ENTITY_EXP_PE ) { EntityDecl ed = ( mPredefdPEs == null ) ? null : mPredefdPEs . get ( id ) ; if ( ed != null ) { mUsesPredefdEntities = true ; mRefdPEs = null ; } else if ( mParamEntities != null ) { ed = mParamEntities . get ( id ) ; if ( ed != null ) { if ( ! mUsesPredefdEntities ) { Set < String > used = mRefdPEs ; if ( used == null ) { mRefdPEs = used = new HashSet < String > ( ) ; } used . add ( id ) ; } } } return ed ; } if ( arg == ENTITY_EXP_GE ) { EntityDecl ed = ( mPredefdGEs == null ) ? null : mPredefdGEs . get ( id ) ; if ( ed != null ) { mUsesPredefdEntities = true ; mRefdGEs = null ; } else if ( mGeneralEntities != null ) { ed = mGeneralEntities . get ( id ) ; if ( ed != null ) { if ( ! mUsesPredefdEntities ) { if ( mRefdGEs == null ) { mRefdGEs = new HashSet < String > ( ) ; } mRefdGEs . add ( id ) ; } } } return ed ; } throw new IllegalStateException ( ErrorConsts . ERR_INTERNAL ) ; }
@param arg If Boolean.TRUE, we are expanding a general entity