freemarker.template.utility
Class HtmlEscape
java.lang.Object
|
+--freemarker.template.utility.HtmlEscape
- All Implemented Interfaces:
- TemplateModel, TemplateTransformModel
- public class HtmlEscape
- extends java.lang.Object
- implements TemplateTransformModel
Performs an HTML escape of a given template fragment. Specifically,
< > " and & are all turned into entities.
Usage:
From java:
TemplateModelRoot root = new SimpleHash();
root.put( "htmlEscape", new freemarker.template.utility.HtmlEscape() );
...
From your FreeMarker template:
The following is HTML-escaped:
<transform htmlEscape>
<p>This paragraph has all HTML special characters escaped.</p>
</transform>
...
- Version:
- $Id: HtmlEscape.java,v 1.6 2002/03/09 20:57:05 revusky Exp $
- See Also:
XmlEscape
Constructor Summary |
HtmlEscape()
Creates new HtmlEscape |
Method Summary |
boolean |
isEmpty()
|
void |
transform(java.io.Reader source,
java.io.Writer output)
Transforms an HTML-unescaped stream into HTML-escaped form. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HtmlEscape
public HtmlEscape()
- Creates new HtmlEscape
transform
public void transform(java.io.Reader source,
java.io.Writer output)
throws TemplateModelException,
java.io.IOException
- Transforms an HTML-unescaped stream into HTML-escaped form. This means:
< > & and " are all escaped into their equivalent entities.
- Specified by:
transform
in interface TemplateTransformModel
- Parameters:
source
- the input to be transformedoutput
- the destination of the transformation
isEmpty
public boolean isEmpty()
throws TemplateModelException
- Specified by:
isEmpty
in interface TemplateModel
- Returns:
- true if this object is empty.