public class EscapeXML
extends java.lang.Object
The specification for <c:out> defines the following
character conversions to be applied:
| Character | Character Entity Code |
|---|---|
| < | < |
| > | > |
| & | & |
| ' | ' |
| " | " |
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String[] |
ESCAPES |
| Constructor and Description |
|---|
EscapeXML() |
| Modifier and Type | Method and Description |
|---|---|
static void |
emit(char[] buffer,
int from,
int count,
javax.servlet.jsp.JspWriter out)
Emit escaped content into the specified JSPWriter.
|
static void |
emit(java.lang.Object src,
boolean escapeXml,
javax.servlet.jsp.JspWriter out)
Emit the supplied object to the specified writer, escaping characters if needed.
|
static void |
emit(java.io.Reader src,
boolean escapeXml,
javax.servlet.jsp.JspWriter out)
Copy the content of a Reader into the specified JSPWriter escaping characters if needed.
|
static void |
emit(java.lang.String src,
boolean escapeXml,
javax.servlet.jsp.JspWriter out)
Emit the supplied String to the specified writer, escaping characters if needed.
|
static void |
emit(java.lang.String src,
javax.servlet.jsp.JspWriter out)
Emit escaped content into the specified JSPWriter.
|
static java.lang.String |
escape(java.lang.String src)
Escape a string.
|
private static java.lang.String |
getEscape(char c) |
private static java.lang.String getEscape(char c)
public static java.lang.String escape(java.lang.String src)
src - the string to escape; must not be nullpublic static void emit(java.lang.Object src,
boolean escapeXml,
javax.servlet.jsp.JspWriter out)
throws java.io.IOException
src - the object to writeescapeXml - if true, escape unsafe characters before writingout - the JspWriter to emit tojava.io.IOException - if there was a problem emitting the contentpublic static void emit(java.lang.String src,
boolean escapeXml,
javax.servlet.jsp.JspWriter out)
throws java.io.IOException
src - the String to writeescapeXml - if true, escape unsafe characters before writingout - the JspWriter to emit tojava.io.IOException - if there was a problem emitting the contentpublic static void emit(java.lang.String src,
javax.servlet.jsp.JspWriter out)
throws java.io.IOException
src - the string to escape; must not be nullout - the JspWriter to emit tojava.io.IOException - if there was a problem emitting the contentpublic static void emit(java.io.Reader src,
boolean escapeXml,
javax.servlet.jsp.JspWriter out)
throws java.io.IOException
src - the Reader to read fromescapeXml - if true, escape charactersout - the JspWriter to emit tojava.io.IOException - if there was a problem emitting the contentpublic static void emit(char[] buffer,
int from,
int count,
javax.servlet.jsp.JspWriter out)
throws java.io.IOException
buffer - characters to escapefrom - start position in the buffercount - number of characters to emitout - the JspWriter to emit tojava.io.IOException - if there was a problem emitting the content