org.millscript.millscript.tools
Class CharacterEntity

java.lang.Object
  extended by org.millscript.millscript.tools.CharacterEntity
Direct Known Subclasses:
XMLCharacterEntity

public class CharacterEntity
extends java.lang.Object

This class implements HTML character entity encoding.


Constructor Summary
CharacterEntity()
          Constructs a new CharacterEntity, with only the mandatory HTML entities defined.
 
Method Summary
 void addEntity(java.lang.String name, java.lang.Character ch)
          Makes the specified entity available for encoding.
 java.lang.Character getCharacterFor(java.lang.String entityName)
          Returns the Unicode character for the specified entity name.
 java.lang.String getEntityFor(char ch)
          Returns the entity for the specified character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharacterEntity

public CharacterEntity()
Constructs a new CharacterEntity, with only the mandatory HTML entities defined.

Method Detail

addEntity

public void addEntity(java.lang.String name,
                      java.lang.Character ch)
Makes the specified entity available for encoding.

Parameters:
name - the entity name
ch - the Unicode character the entity represents

getEntityFor

public java.lang.String getEntityFor(char ch)
Returns the entity for the specified character. The entity will be named if we have a mapping for that character, otherwise it will be numeric.

Parameters:
ch - the character to entity encode
Returns:
a named or numeric entity for the specified character.

getCharacterFor

public java.lang.Character getCharacterFor(java.lang.String entityName)
Returns the Unicode character for the specified entity name.

Parameters:
entityName - the entity name to get a character for
Returns:
a Character for the specified entity name or null if there is no mapping


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.