com.oopreserch.web
Class EscapeForXml
java.lang.Object
|
+--com.oopreserch.web.EscapeForXml
- All Implemented Interfaces:
- FormValueEscaper
- public class EscapeForXml
- extends java.lang.Object
- implements FormValueEscaper
The implementation of FormValueEscaper interface.
Replace the special characters with the escaped ones.
If the String with the special characters (such as
< or >) is inserted into the
XML, the concatenated String will be invalid
as the XML.
To avoid this kind of problems, the String should be
escaped before it is inserted into the XML tags.
This class replaces the special characters for XML.
The table below lists the special characters and their
corresponding escaped characters:
| Original Character |
Escaped Character |
| < |
< |
| > |
> |
| & |
& |
| " |
" |
| ' |
' |
The implementations for HTML, HDML and WML are also included
in this package. They are:
All the available implementations of this interface must be
defined in:
- (docBase)/WEB-INF/classes/FormValueEscaperFactory.properties
In this property resource file, the value is the fully
qualified class name of each implementation.
The corresponding key is the arbitrary String, and you can
specify it as the value of escape.type
attribute in d.value element in the XML.
For details about this property resource file, please look
into FormValueEscaperFactory.
- Author:
- Jun Inamori
|
Method Summary |
java.lang.String |
getEscaped(java.lang.String org)
Escape the special characters for XML. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EscapeForXml
public EscapeForXml()
getEscaped
public java.lang.String getEscaped(java.lang.String org)
- Escape the special characters for XML.
- Specified by:
getEscaped in interface FormValueEscaper
- Parameters:
org - The original String- Returns:
- The escaped String
ALL CONTENTS COPYRIGHT 2002, Jun Inamori. All rights reserved.
Any questions and comments are welcome to Jun Inamori.