org.apache.commons.lang
Class Entities

java.lang.Object
  extended by org.apache.commons.lang.Entities

public class Entities
extends Object

Provides HTML and XML entity utilities.

Since:
2.0
Version:
$Id: Entities.java,v 1.1 2008-05-02 15:43:01 gudy Exp $
Author:
Alexander Day Chaffee, Gary Gregory
See Also:
ISO Entities,
HTML 3.2 Character Entities for ISO Latin-1,
HTML 4.0 Character entity references,
HTML 4.01 Character References,
HTML 4.01 Code positions

Field Summary
static Entities HTML32
          The set of entities supported by HTML 3.2.
static Entities HTML40
          The set of entities supported by HTML 4.0.
static Entities XML
          The set of entities supported by standard XML.
 
Constructor Summary
Entities()
           
 
Method Summary
 void addEntities(String[][] entityArray)
           
 void addEntity(String name, int value)
           
 String entityName(int value)
           
 int entityValue(String name)
           
 String escape(String str)
          Escapes the characters in a String.
 String unescape(String str)
          Unescapes the entities in a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML

public static final Entities XML

The set of entities supported by standard XML.


HTML32

public static final Entities HTML32

The set of entities supported by HTML 3.2.


HTML40

public static final Entities HTML40

The set of entities supported by HTML 4.0.

Constructor Detail

Entities

public Entities()
Method Detail

addEntities

public void addEntities(String[][] entityArray)

addEntity

public void addEntity(String name,
                      int value)

entityName

public String entityName(int value)

entityValue

public int entityValue(String name)

escape

public String escape(String str)

Escapes the characters in a String.

For example, if you have called addEntity("foo", 0xA1), escape("") will return "&foo;"

Parameters:
str - The String to escape.
Returns:
A new escaped String.

unescape

public String unescape(String str)

Unescapes the entities in a String.

For example, if you have called addEntity("foo", 0xA1), unescape("&foo;") will return ""

Parameters:
str - The String to escape.
Returns:
A new escaped String.