code: protected EntityDecl expandEntity(String id, boolean allowExt,
                                        Object extraArg)
          throws XMLStreamException
      {
          mCurrName = id;
  
          EntityDecl ed = findEntity(id, extraArg);
  
          if (ed == null) {
              /* 30-Sep-2005, TSa: As per [WSTX-5], let's only throw exception
               *   if we have to resolve it (otherwise it's just best-effort, 
               *   and null is ok)
               */
              /* 02-Oct-2005, TSa: Plus, [WSTX-4] adds "undeclared entity
               *    resolver"
               */
              if (mCfgReplaceEntities) {
                  mCurrEntity = expandUnresolvedEntity(id);
              }
              return null;
          }
          
          if (!mCfgTreatCharRefsAsEntities || this instanceof MinimalDTDReader) {
              expandEntity(ed, allowExt);
          }
          
          return ed;
      }
docs: Helper method that will try to expand a parsed entity (parameter or
  generic entity).
  <p>
  note: called by sub-classes (dtd parser), needs to be protected.
  
  @param id Name of the entity being expanded
  @param allowExt Whether external entities can be expanded or not; if
  not, and the entity to expand would be external one, an exception
  will be thrown