public static String convertCharEntity(String charEntity,boolean lookupHTMLentities,Hashtable userDefinedCharEntities){
  int charCode=-1;
  if (charEntity.startsWith("#")) {
    if (charEntity.startsWith("#x")) {
      try {
        charCode=Integer.parseInt(charEntity.substring(2),16);
      }
 catch (      NumberFormatException nfe) {
      }
    }
 else {
      try {
        charCode=Integer.parseInt(charEntity.substring(1));
      }
 catch (      NumberFormatException nfe) {
      }
    }
  }
 else {
    charCode=getCharEntityCode(charEntity,lookupHTMLentities,userDefinedCharEntities);
  }
  if (charCode != -1) {
    return "" + (char)charCode;
  }
 else {
    throw new IllegalArgumentException("Unknown character entity - " + charEntity);
  }
}

public static String convertCharEntity ( String charEntity , boolean lookupHTMLentities , Hashtable userDefinedCharEntities ) { int charCode = - 1 ; if ( charEntity . startsWith ( "#" ) ) { if ( charEntity . startsWith ( "#x" ) ) { try { charCode = Integer . parseInt ( charEntity . substring ( 2 ) , 16 ) ; } catch ( NumberFormatException nfe ) { } } else { try { charCode = Integer . parseInt ( charEntity . substring ( 1 ) ) ; } catch ( NumberFormatException nfe ) { } } } else { charCode = getCharEntityCode ( charEntity , lookupHTMLentities , userDefinedCharEntities ) ; } if ( charCode != - 1 ) { return "" + ( char ) charCode ; } else { throw new IllegalArgumentException ( "Unknown character entity - " + charEntity ) ; } }
converts a char entity to the matching character or string . this handles both numbered and symbol char entities ( the latter is done via getcharentitycode )
