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 executed:
<transform htmlEscape>
<p>This paragraph has all HTML special characters escaped.</p>
</transform>
...
- Version:
- $Id: HtmlEscape.java,v 1.3 2001/05/29 11:54:10 run2000 Exp $
- See Also:
XmlEscape
|
Constructor Summary |
HtmlEscape()
Creates new HtmlEscape |
|
Method Summary |
boolean |
isEmpty()
|
void |
transform(java.io.Reader source,
java.io.PrintWriter 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.PrintWriter output)
throws TemplateModelException
- 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.