Package org.apache.taglibs.standard.util
Class EscapeXML
- java.lang.Object
-
- org.apache.taglibs.standard.util.EscapeXML
-
public class EscapeXML extends java.lang.Object
Handles escaping of characters that could be interpreted as XML markup.The specification for
<c:out>
defines the following character conversions to be applied:Character Character Entity Code < < > > & & ' ' " "
-
-
Constructor Summary
Constructors Constructor Description EscapeXML()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
emit(char[] buffer, int from, int count, JspWriter out)
Emit escaped content into the specified JSPWriter.static void
emit(java.io.Reader src, boolean escapeXml, JspWriter out)
Copy the content of a Reader into the specified JSPWriter escaping characters if needed.static void
emit(java.lang.Object src, boolean escapeXml, JspWriter out)
Emit the supplied object to the specified writer, escaping characters if needed.static void
emit(java.lang.String src, boolean escapeXml, JspWriter out)
Emit the supplied String to the specified writer, escaping characters if needed.static void
emit(java.lang.String src, JspWriter out)
Emit escaped content into the specified JSPWriter.static java.lang.String
escape(java.lang.String src)
Escape a string.
-
-
-
Method Detail
-
escape
public static java.lang.String escape(java.lang.String src)
Escape a string.- Parameters:
src
- the string to escape; must not be null- Returns:
- the escaped string
-
emit
public static void emit(java.lang.Object src, boolean escapeXml, JspWriter out) throws java.io.IOException
Emit the supplied object to the specified writer, escaping characters if needed.- Parameters:
src
- the object to writeescapeXml
- if true, escape unsafe characters before writingout
- the JspWriter to emit to- Throws:
java.io.IOException
- if there was a problem emitting the content
-
emit
public static void emit(java.lang.String src, boolean escapeXml, JspWriter out) throws java.io.IOException
Emit the supplied String to the specified writer, escaping characters if needed.- Parameters:
src
- the String to writeescapeXml
- if true, escape unsafe characters before writingout
- the JspWriter to emit to- Throws:
java.io.IOException
- if there was a problem emitting the content
-
emit
public static void emit(java.lang.String src, JspWriter out) throws java.io.IOException
Emit escaped content into the specified JSPWriter.- Parameters:
src
- the string to escape; must not be nullout
- the JspWriter to emit to- Throws:
java.io.IOException
- if there was a problem emitting the content
-
emit
public static void emit(java.io.Reader src, boolean escapeXml, JspWriter out) throws java.io.IOException
Copy the content of a Reader into the specified JSPWriter escaping characters if needed.- Parameters:
src
- the Reader to read fromescapeXml
- if true, escape charactersout
- the JspWriter to emit to- Throws:
java.io.IOException
- if there was a problem emitting the content
-
emit
public static void emit(char[] buffer, int from, int count, JspWriter out) throws java.io.IOException
Emit escaped content into the specified JSPWriter.- Parameters:
buffer
- characters to escapefrom
- start position in the buffercount
- number of characters to emitout
- the JspWriter to emit to- Throws:
java.io.IOException
- if there was a problem emitting the content
-
-