Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal.utils
Class XMLEscaper

    java.lang.Object
      org.jasig.portal.utils.XMLEscaper

    public class XMLEscaper

extends java.lang.Object

This utility provides a simple way of escaping the special or reserved characters in XML that serve as delimiters so that a string of characters can be left untouched by an XML parser. See http://www.w3.org/TR/2000/REC-xml-20001006#syntax and http://www.w3.org/TR/2000/REC-xml-20001006#sec-predefined-ent and http://www.w3.org/TR/2000/REC-xml-20001006#sec-entexpand Most of the code was borrowed from Xerces serializer classes. If anyone finds a useable method in a standard XML API that escapes XML strings, we should use it in place of this class.

Version:
  $Revision: 1.6 $
Author:
  Ken Weiner, kweiner@unicon.net

Constructor Summary
`XMLEscaper()`

Method Summary
`static java.lang.String` | `escape(char ch)` Escapes an XML character
`static java.lang.String` | `escape(java.lang.String source)` Escapes an XML string
`private static java.lang.String` | `getEntityRef(char ch)`
`static void` | `main(java.lang.String[] args)` This method is provided to test out the escape method.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XMLEscaper

    public XMLEscaper()

Method Detail

### escape

    public static java.lang.String escape(java.lang.String source)

  Escapes an XML string

  Parameters:
    `source` - a String to be escaped
  Returns:
    an escaped String

### escape

    public static java.lang.String escape(char ch)

  Escapes an XML character

  Parameters:
    `ch` - a char to be escaped
  Returns:
    an escaped char

### getEntityRef

    private static java.lang.String getEntityRef(char ch)

### main

    public static void main(java.lang.String[] args)

  This method is provided to test out the escape method.

  Parameters:
    `args` - the command line arguments

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD