com.atlassian.renderer.v2.components
Class HtmlEscaper

java.lang.Object
  extended by com.atlassian.renderer.v2.components.HtmlEscaper

public final class HtmlEscaper
extends java.lang.Object


Method Summary
static java.lang.String escapeAll(java.lang.String s, boolean preserveExistingEntities)
          Replaces the HTML special characters less-than (<), greater-than (>), double-quote ("), single-quote/apostrophe ('), and ampersand (&) with their equivalent entities in HTML 4 and returns the result.
static java.lang.String escapeAllExceptQuotes(java.lang.String s, boolean preserveExistingEntities)
          Does the same as escapeAll(String,boolean), except doesn't replace the ASCII quotation mark characters double-quote (") and single-quote/apostrophe (').
static java.lang.String escapeAmpersands(java.lang.String s, boolean preserveExistingEntities)
          Replaces ampersand (&) characters with the equivalent HTML entity (&amp;) and returns the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

escapeAll

public static java.lang.String escapeAll(java.lang.String s,
                                         boolean preserveExistingEntities)
Replaces the HTML special characters less-than (<), greater-than (>), double-quote ("), single-quote/apostrophe ('), and ampersand (&) with their equivalent entities in HTML 4 and returns the result. Also maps the Microsoft Windows-1252 "smart quotes" characters (145-148) with their equivalent HTML entities.

Parameters:
s - the String to escape
preserveExistingEntities - if true, will avoid escaping the ampersand in an existing entity like &lt;. If false, the method will do a normal escaping by replace all matched characters.
Returns:
the string with special characters replaced by entities.

escapeAllExceptQuotes

public static java.lang.String escapeAllExceptQuotes(java.lang.String s,
                                                     boolean preserveExistingEntities)
Does the same as escapeAll(String,boolean), except doesn't replace the ASCII quotation mark characters double-quote (") and single-quote/apostrophe (').

Parameters:
s - the String to escape
preserveExistingEntities - if true, will avoid escaping the ampersand in an existing entity like &lt;. If false, the method will do a normal escaping by replace all matched characters.
Returns:
the string with special characters replaced by entities.

escapeAmpersands

public static java.lang.String escapeAmpersands(java.lang.String s,
                                                boolean preserveExistingEntities)
Replaces ampersand (&) characters with the equivalent HTML entity (&amp;) and returns the result.

Parameters:
s - the String to escape
preserveExistingEntities - if true, will avoid escaping the ampersand in an existing entity like &lt;. If false, the method will do a normal escaping by replace all matched characters.
Returns:
the string with special characters replaced by entities.


Copyright © 2013 Atlassian. All Rights Reserved.