org.apache.taglibs.standard.util
Class EscapeXML

java.lang.Object
  extended by org.apache.taglibs.standard.util.EscapeXML

public class EscapeXML
extends 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:

CharacterCharacter Entity Code
<&lt;
>&gt;
&&amp;
'&#039;
"&#034;


Constructor Summary
EscapeXML()
           
 
Method Summary
static void emit(char[] buffer, int from, int count, javax.servlet.jsp.JspWriter out)
          Emit escaped content into the specified JSPWriter.
static void emit(Object src, boolean escapeXml, javax.servlet.jsp.JspWriter out)
          Emit the supplied object to the specified writer, escaping characters if needed.
static void emit(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(String src, boolean escapeXml, javax.servlet.jsp.JspWriter out)
          Emit the supplied String to the specified writer, escaping characters if needed.
static void emit(String src, javax.servlet.jsp.JspWriter out)
          Emit escaped content into the specified JSPWriter.
static String escape(String src)
          Escape a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EscapeXML

public EscapeXML()
Method Detail

escape

public static String escape(String src)
Escape a string.

Parameters:
src - the string to escape; must not be null
Returns:
the escaped string

emit

public static void emit(Object src,
                        boolean escapeXml,
                        javax.servlet.jsp.JspWriter out)
                 throws IOException
Emit the supplied object to the specified writer, escaping characters if needed.

Parameters:
src - the object to write
escapeXml - if true, escape unsafe characters before writing
out - the JspWriter to emit to
Throws:
IOException - if there was a problem emitting the content

emit

public static void emit(String src,
                        boolean escapeXml,
                        javax.servlet.jsp.JspWriter out)
                 throws IOException
Emit the supplied String to the specified writer, escaping characters if needed.

Parameters:
src - the String to write
escapeXml - if true, escape unsafe characters before writing
out - the JspWriter to emit to
Throws:
IOException - if there was a problem emitting the content

emit

public static void emit(String src,
                        javax.servlet.jsp.JspWriter out)
                 throws IOException
Emit escaped content into the specified JSPWriter.

Parameters:
src - the string to escape; must not be null
out - the JspWriter to emit to
Throws:
IOException - if there was a problem emitting the content

emit

public static void emit(Reader src,
                        boolean escapeXml,
                        javax.servlet.jsp.JspWriter out)
                 throws IOException
Copy the content of a Reader into the specified JSPWriter escaping characters if needed.

Parameters:
src - the Reader to read from
escapeXml - if true, escape characters
out - the JspWriter to emit to
Throws:
IOException - if there was a problem emitting the content

emit

public static void emit(char[] buffer,
                        int from,
                        int count,
                        javax.servlet.jsp.JspWriter out)
                 throws IOException
Emit escaped content into the specified JSPWriter.

Parameters:
buffer - characters to escape
from - start position in the buffer
count - number of characters to emit
out - the JspWriter to emit to
Throws:
IOException - if there was a problem emitting the content


Copyright © 2001-2015 The Apache Software Foundation. All Rights Reserved.