org.xwiki.velocity.tools
Class EscapeTool

java.lang.Object
  extended by org.apache.velocity.tools.generic.EscapeTool
      extended by org.xwiki.velocity.tools.EscapeTool

public class EscapeTool
extends org.apache.velocity.tools.generic.EscapeTool

Tool for working with escaping in Velocity templates. It provides methods to escape outputs for Velocity, Java, JavaScript, HTML, XML and SQL.

Extends the default EscapeTool from velocity-tools since the XML escape performed by it doesn't work inside HTML content, since apos is not a valid HTML entity name, and it always escapes non-ASCII characters, which increases the HTML length considerably, while also making the source unreadable.

Since:
2.7RC1
Version:
$Id: EscapeTool.java 35081 2011-03-03 12:15:24Z vmassol $

Constructor Summary
EscapeTool()
           
 
Method Summary
 java.lang.String xml(java.lang.Object content)
          Escapes the XML special characters in a String using numerical XML entities.
 
Methods inherited from class org.apache.velocity.tools.generic.EscapeTool
dumpString, getB, getBackslash, getD, getDollar, getE, getExclamation, getH, getHash, getQ, getQuote, getS, getSingleQuote, html, java, javascript, propertyKey, propertyValue, sql, url
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EscapeTool

public EscapeTool()
Method Detail

xml

public java.lang.String xml(java.lang.Object content)
Escapes the XML special characters in a String using numerical XML entities.

Overrides:
xml in class org.apache.velocity.tools.generic.EscapeTool
Parameters:
content - the text to escape, may be null
Returns:
a new escaped String, null if null input


Copyright © 2004-2011 XWiki. All Rights Reserved.