|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jasig.portal.utils.XMLEscaper
public class XMLEscaper
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.
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 |
---|
public XMLEscaper()
Method Detail |
---|
public static java.lang.String escape(java.lang.String source)
source
- a String to be escaped
public static java.lang.String escape(char ch)
ch
- a char to be escaped
private static java.lang.String getEntityRef(char ch)
public static void main(java.lang.String[] args)
args
- the command line arguments
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |