code: private int resolveCharEnt(StringBuffer originalCharacters)
          throws XMLStreamException
      {
          int value = 0;
          char c = getNextChar(SUFFIX_IN_ENTITY_REF);
          
          if (originalCharacters != null) {
              originalCharacters.append(c);
          }
          
          if (c == 'x') { // hex
              while (true) {
                  c = (mInputPtr < mInputEnd) ? mInputBuffer[mInputPtr++]
                      : getNextCharFromCurrent(SUFFIX_IN_ENTITY_REF);
                  if (c == ';') {
                      break;
                  }
                  
                  if (originalCharacters != null) {
                      originalCharacters.append(c);
                  }
                  value = value << 4;
                  if (c <= '9' && c >= '0') {
                      value += (c - '0');
                  } else if (c >= 'a' && c <= 'f') {
                      value += 10 + (c - 'a');
                  } else if (c >= 'A' && c <= 'F') {
                      value += 10 + (c - 'A');
                  } else {
                      throwUnexpectedChar(c, "; expected a hex digit (0-9a-fA-F).");
                  }
                  // Overflow?
                  if (value > MAX_UNICODE_CHAR) {
                      reportUnicodeOverflow();
                  }
              }
          } else { // numeric (decimal)
              while (c != ';') {
                  if (c <= '9' && c >= '0') {
                      value = (value * 10) + (c - '0');
                      // Overflow?
                      if (value > MAX_UNICODE_CHAR) {
                          reportUnicodeOverflow();
                      }
                  } else {
                      throwUnexpectedChar(c, "; expected a decimal number.");
                  }
                  c = (mInputPtr < mInputEnd) ? mInputBuffer[mInputPtr++]
                      : getNextCharFromCurrent(SUFFIX_IN_ENTITY_REF);
                  
                  if (originalCharacters != null && c != ';') {
                      originalCharacters.append(c);
                  }
              }
          }
          validateChar(value);
          return value;
      }
docs: /*
  /////////////////////////////////////////////////////////////////////
  Internal methods
  /////////////////////////////////////////////////////////////////////