com.jrefinery.report.util
Class CharacterEntityParser

java.lang.Object
  extended bycom.jrefinery.report.util.CharacterEntityParser

public class CharacterEntityParser
extends java.lang.Object

The character entity parser replaces all known occurrences of an entity in the format &entityname;.

Author:
Thomas Morgner

Constructor Summary
protected CharacterEntityParser(java.util.Properties characterEntities)
          Creates a new CharacterEntityParser and initializes the parser with the given set of entities.
 
Method Summary
static CharacterEntityParser createHTMLEntityParser()
          create a new Character entity parser and initializes the parser with the entities defined in the HTML4 standard.
static CharacterEntityParser createXMLEntityParser()
          create a new Character entity parser and initializes the parser with the entities defined in the XML standard.
 java.lang.String decodeEntities(java.lang.String value)
          Decode the string, all known entities are replaced by their resolved characters.
 java.lang.String encodeEntities(java.lang.String value)
          Encode the given String, so that all known entites are encoded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharacterEntityParser

protected CharacterEntityParser(java.util.Properties characterEntities)
Creates a new CharacterEntityParser and initializes the parser with the given set of entities.

Parameters:
characterEntities - the entities used for the parser
Method Detail

createHTMLEntityParser

public static CharacterEntityParser createHTMLEntityParser()
create a new Character entity parser and initializes the parser with the entities defined in the HTML4 standard.

Returns:
the CharacterEntityParser initialized with HTML4 entities.

createXMLEntityParser

public static CharacterEntityParser createXMLEntityParser()
create a new Character entity parser and initializes the parser with the entities defined in the XML standard.

Returns:
the CharacterEntityParser initialized with XML entities.

encodeEntities

public java.lang.String encodeEntities(java.lang.String value)
Encode the given String, so that all known entites are encoded. All characters represented by these entites are now removed from the string.

Parameters:
value - the original string
Returns:
the encoded string.

decodeEntities

public java.lang.String decodeEntities(java.lang.String value)
Decode the string, all known entities are replaced by their resolved characters.

Parameters:
value - the string that should be decoded.
Returns:
the decoded string.