org.webmacro.util
Class HTMLEscaper

java.lang.Object
  extended byorg.webmacro.util.HTMLEscaper

public class HTMLEscaper
extends java.lang.Object

This class will escape characters that have an HTML entity representation. It will not escape standard ASCII characters unless it is necessary (i.e. will not escape ASCI #32 but will escape "&"). Any characters with no corresponding entity are passed through unchanged. It uses a quick string -> array mapping to avoid creating thousands of temporary objects.


Constructor Summary
HTMLEscaper()
           
 
Method Summary
static java.lang.String escape(java.lang.String nonHTMLsrc)
          This method will take the input and escape characters that have an HTML entity representation.
static void main(java.lang.String[] args)
          A little bit of unit testing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLEscaper

public HTMLEscaper()
Method Detail

main

public static void main(java.lang.String[] args)
A little bit of unit testing


escape

public static final java.lang.String escape(java.lang.String nonHTMLsrc)
This method will take the input and escape characters that have an HTML entity representation. It uses a quick string -> array mapping to avoid creating thousands of temporary objects.

Parameters:
nonHTMLsrc - String containing the text to make HTML-safe
Returns:
String containing new copy of string with ENTITIES escaped