Package net.sf.okapi.common
Class HTMLCharacterEntities
- java.lang.Object
-
- net.sf.okapi.common.HTMLCharacterEntities
-
public class HTMLCharacterEntities extends Object
Helper class to handle HTML character entities.
-
-
Constructor Summary
Constructors Constructor Description HTMLCharacterEntities()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidensureInitialization(boolean includeSpecialChars)Ensures the lookup table is initialized.StringgetName(char value)Gets the entity name for the given character.intlookupName(String name)Gets the character for a given entity name (e.g.intlookupReference(String ref)Gets the character for a given character entity reference (e.g.
-
-
-
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.
-
-