Logo Search packages:      
Sourcecode: jericho-html version File versions  Download package

static int au::id::jericho::lib::html::CharacterEntityReference::getCodePointFromName ( final String  name  )  [inline, static]

Returns the unicode code point of the specified character entity reference name.

If the string does not represent a valid character entity reference name, this method returns INVALID_CODE_POINT.

Although character entity reference names are case sensitive, and in some cases differ from other entity references only by their case, some browsers also recognise them in a case-insensitive way. For this reason, all decoding methods in this library recognise character entity reference names even if they are in the wrong case.

Example:
CharacterEntityReference.getCodePointFromName("gt") returns 62
Returns:
the unicode code point of the specified character entity reference name, or INVALID_CODE_POINT if the string does not represent a valid character entity reference name.

Definition at line 908 of file CharacterEntityReference.java.

References au::id::jericho::lib::html::CharacterReference::INVALID_CODE_POINT.

                                                                {
            Integer codePoint=(Integer)NAME_TO_CODE_POINT_MAP.get(name);
            if (codePoint==null) {
                  // Most browsers recognise character entity references even if they have the wrong case, so check for this as well:
                  final String lowerCaseName=name.toLowerCase();
                  if (lowerCaseName!=name) codePoint=(Integer)NAME_TO_CODE_POINT_MAP.get(lowerCaseName);
            }
            return (codePoint!=null) ? codePoint.intValue() : INVALID_CODE_POINT;
      }


Generated by  Doxygen 1.6.0   Back to index