code: public ElementId addReferenced(char[] buffer, int start, int len, int hash,
                                     Location loc, PrefixedName elemName, PrefixedName attrName)
      {
          int index = (hash & mIndexMask);
          ElementId id = mTable[index];
  
          while (id != null) {
              if (id.idMatches(buffer, start, len)) { // found existing one
                  return id;
              }
              id = id.nextColliding();
          }
  
          // Not found, need to create a placeholder...
  
          // But first, do we need more room?
          if (mSize >= mSizeThreshold) {
              rehash();
              // Index changes, for the new entr:
              index = (hash & mIndexMask);
          }
          ++mSize;
  
          // Ok, then, let's create the entry
          String idStr = new String(buffer, start, len);
          id = new ElementId(idStr, loc, false, elemName, attrName);
  
          // First, let's link it to Map; all ids have to be connected
          id.setNextColliding(mTable[index]);
          mTable[index] = id;
  
          // And then add the undefined entry at the end of list
          if (mHead == null) {
              mHead = mTail = id;
          } else {
              mTail.linkUndefined(id);
              mTail = id;
          }
          return id;
      }
docs: Method called when a reference to id is encountered. If so, need
  to check if specified id entry (ref or definiton) exists; and if not,
  to add a reference marker.