com.tecnick.htmlutils.htmlentities
Class HTMLEntities

java.lang.Object
  extended by com.tecnick.htmlutils.htmlentities.HTMLEntities

public class HTMLEntities
extends java.lang.Object

Collection of static methods to convert special and extended characters into HTML entitities and vice versa.

Copyright (c) 2004-2005 Tecnick.com S.r.l (www.tecnick.com) Via Ugo Foscolo n.19 - 09045 Quartu Sant'Elena (CA) - ITALY - www.tecnick.com - info@tecnick.com
Project homepage: http://htmlentities.sourceforge.net
License: http://www.gnu.org/copyleft/lesser.html LGPL

Version:
1.0.004
Author:
Nicola Asuni [www.tecnick.com].

Constructor Summary
HTMLEntities()
          Initialize HTML translation maps.
 
Method Summary
static java.lang.Object[][] getEntitiesTable()
          Get the html entities translation table.
static java.lang.String htmlAmpersand(java.lang.String str)
          Replace & characters with & HTML entities.
static java.lang.String htmlAngleBrackets(java.lang.String str)
          Replace < > characters with &lt; &gt; entities.
static java.lang.String htmlDoubleQuotes(java.lang.String str)
          Replace double quotes characters with HTML entities.
static java.lang.String htmlentities(java.lang.String str)
          Convert special and extended characters into HTML entitities.
static java.lang.String htmlQuotes(java.lang.String str)
          Replace single and double quotes characters with HTML entities.
static java.lang.String htmlSingleQuotes(java.lang.String str)
          Replace single quotes characters with HTML entities.
static java.lang.String unhtmlAmpersand(java.lang.String str)
          Replace &amp; HTML entities with & characters.
static java.lang.String unhtmlAngleBrackets(java.lang.String str)
          Replace &lt; &gt; entities with < > characters.
static java.lang.String unhtmlDoubleQuotes(java.lang.String str)
          Replace single quotes HTML entities with equivalent character.
static java.lang.String unhtmlentities(java.lang.String str)
          Convert HTML entities to special and extended unicode characters equivalents.
static java.lang.String unhtmlQuotes(java.lang.String str)
          Replace single and double quotes HTML entities with equivalent characters.
static java.lang.String unhtmlSingleQuotes(java.lang.String str)
          Replace single quotes HTML entities with equivalent character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLEntities

public HTMLEntities()
Initialize HTML translation maps.

Method Detail

getEntitiesTable

public static java.lang.Object[][] getEntitiesTable()
Get the html entities translation table.

Returns:
translation table

htmlentities

public static java.lang.String htmlentities(java.lang.String str)
Convert special and extended characters into HTML entitities.

Parameters:
str - input string
Returns:
formatted string
See Also:
unhtmlentities(String)

unhtmlentities

public static java.lang.String unhtmlentities(java.lang.String str)
Convert HTML entities to special and extended unicode characters equivalents.

Parameters:
str - input string
Returns:
formatted string
See Also:
htmlentities(String)

htmlSingleQuotes

public static java.lang.String htmlSingleQuotes(java.lang.String str)
Replace single quotes characters with HTML entities.

Parameters:
str - the input string
Returns:
string with replaced single quotes

unhtmlSingleQuotes

public static java.lang.String unhtmlSingleQuotes(java.lang.String str)
Replace single quotes HTML entities with equivalent character.

Parameters:
str - the input string
Returns:
string with replaced single quotes

htmlDoubleQuotes

public static java.lang.String htmlDoubleQuotes(java.lang.String str)
Replace double quotes characters with HTML entities.

Parameters:
str - the input string
Returns:
string with replaced double quotes

unhtmlDoubleQuotes

public static java.lang.String unhtmlDoubleQuotes(java.lang.String str)
Replace single quotes HTML entities with equivalent character.

Parameters:
str - the input string
Returns:
string with replaced single quotes

htmlQuotes

public static java.lang.String htmlQuotes(java.lang.String str)
Replace single and double quotes characters with HTML entities.

Parameters:
str - the input string
Returns:
string with replaced quotes

unhtmlQuotes

public static java.lang.String unhtmlQuotes(java.lang.String str)
Replace single and double quotes HTML entities with equivalent characters.

Parameters:
str - the input string
Returns:
string with replaced quotes

htmlAngleBrackets

public static java.lang.String htmlAngleBrackets(java.lang.String str)
Replace < > characters with &lt; &gt; entities.

Parameters:
str - the input string
Returns:
string with replaced characters

unhtmlAngleBrackets

public static java.lang.String unhtmlAngleBrackets(java.lang.String str)
Replace &lt; &gt; entities with < > characters.

Parameters:
str - the input string
Returns:
string with replaced entities

htmlAmpersand

public static java.lang.String htmlAmpersand(java.lang.String str)
Replace & characters with &amp; HTML entities.

Parameters:
str - the input string
Returns:
string with replaced characters

unhtmlAmpersand

public static java.lang.String unhtmlAmpersand(java.lang.String str)
Replace &amp; HTML entities with & characters.

Parameters:
str - the input string
Returns:
string with replaced entities