code: private void combineElements(InputProblemReporter rep, HashMap<PrefixedName,DTDElement> intElems, HashMap<PrefixedName,DTDElement> extElems)
          throws XMLStreamException
      {
      	for (Map.Entry<PrefixedName,DTDElement> me : extElems.entrySet()) {
              PrefixedName key = me.getKey();
              DTDElement extElem = me.getValue();
              DTDElement intElem = intElems.get(key);
  
              // If there was no old value, can just merge new one in and continue
              if (intElem == null) {
                  intElems.put(key, extElem);
                  continue;
              }
  
              // Which one is defined (if either)?
              if (extElem.isDefined()) { // one from the ext subset
                  if (intElem.isDefined()) { // but both can't be; that's an error
                      throwElementException(intElem, extElem.getLocation());
                  } else {
                      /* Note: can/should not modify the external element (by
                       * for example adding attributes); external element may
                       * be cached and shared... so, need to do the reverse,
                       * define the one from internal subset.
                       */
                      intElem.defineFrom(rep, extElem, mFullyValidating);
                  }
              } else {
                  if (!intElem.isDefined()) {
                      /* ??? Should we warn about neither of them being really
                       *   declared?
                       */
                      rep.reportProblem(intElem.getLocation(),
                                        ErrorConsts.WT_ENT_DECL,
                                        ErrorConsts.W_UNDEFINED_ELEM,
                                        extElem.getDisplayName(), null);
                                        
                  } else {
                      intElem.mergeMissingAttributesFrom(rep, extElem, mFullyValidating);
                  }
              }
          }
      }
docs: Method that will try to merge in elements defined in the external
  subset, into internal subset; it will also check for redeclarations
  when doing this, as it's invalid to redeclare elements. Care has to
  be taken to only check actual redeclarations: placeholders should
  not cause problems.