Class HTMLCharacterEntities


  • public class HTMLCharacterEntities
    extends Object
    Helper class to handle HTML character entities.
    • Constructor Detail

      • HTMLCharacterEntities

        public HTMLCharacterEntities()
    • Method Detail

      • ensureInitialization

        public void ensureInitialization​(boolean includeSpecialChars)
        Ensures the lookup table is initialized. You must call this method before using others.
        Parameters:
        includeSpecialChars - true if XML-pre-defined entities should be included in the list of supported entities.
      • lookupReference

        public int lookupReference​(String ref)
        Gets the character for a given character entity reference (e.g. "á").
        Parameters:
        ref - the reference to lookup.
        Returns:
        the unicode value for the given reference, or -1 if it was not found.
      • lookupName

        public int lookupName​(String name)
        Gets the character for a given entity name (e.g. "aacute").
        Parameters:
        name - the name to lookup.
        Returns:
        the unicode value for the given name, or -1 if it was not found.
      • getName

        public String getName​(char value)
        Gets the entity name for the given character.
        Parameters:
        value - the character to lookup.
        Returns:
        the name for the given character, or null if it was not found.