com.topologi.diffx.xml.esc
Class XMLEscapeASCII

java.lang.Object
  extended bycom.topologi.diffx.xml.esc.XMLEscapeBase
      extended bycom.topologi.diffx.xml.esc.XMLEscapeASCII
All Implemented Interfaces:
XMLEscape

public final class XMLEscapeASCII
extends com.topologi.diffx.xml.esc.XMLEscapeBase
implements XMLEscape

A singleton for escaping XML data when using the 'ASCII' encoding.

Version:
7 March 2005
Author:
Christophe Lauret

Field Summary
static XMLEscape ASCII_ESCAPE
          A static instance of the UTF8 escape class.
 
Method Summary
 String getEncoding()
          Returns the encoding used.
 String toAttributeValue(char[] ch, int off, int len)
          Replaces '<', '&', '"' and '\'' as well an any character that is not part of the standard unicode range.
 String toAttributeValue(String value)
          Default implementation calling the XMLEscape.toAttributeValue(char[], int, int).
 String toElementText(char[] ch, int off, int len)
          Replace characters which are invalid in element values, by the corresponding entity in a given String.
 String toElementText(String value)
          Default implementation calling the XMLEscape.toAttributeValue(char[], int, int).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.topologi.diffx.xml.esc.XMLEscape
getEncoding, toAttributeValue, toElementText
 

Field Detail

ASCII_ESCAPE

public static final XMLEscape ASCII_ESCAPE
A static instance of the UTF8 escape class.

Method Detail

toAttributeValue

public String toAttributeValue(char[] ch,
                               int off,
                               int len)
Replaces '<', '&', '"' and '\'' as well an any character that is not part of the standard unicode range.
 Char ::= #x9 | #xA | #xD |
          [#x20-#xD7FF] |
          [#xE000-#xFFFD] |
          [#x10000-#x10FFFF]
 

Specified by:
toAttributeValue in interface XMLEscape
Parameters:
ch - The value that needs to be attribute-escaped.
off - The start (offset) of the characters.
len - The length of characters to.
Returns:
A well-formed value for the attribute.
See Also:
XMLEscape.toAttributeValue(char[], int, int)

toElementText

public String toElementText(char[] ch,
                            int off,
                            int len)
Replace characters which are invalid in element values, by the corresponding entity in a given String.

these characters are:


toAttributeValue

public final String toAttributeValue(String value)
Default implementation calling the XMLEscape.toAttributeValue(char[], int, int).

Specified by:
toAttributeValue in interface XMLEscape
Parameters:
value - The value that needs to be attribute-escaped.
Returns:
A well-formed value for the attribute.
See Also:
XMLEscape.toAttributeValue(String)

toElementText

public final String toElementText(String value)
Default implementation calling the XMLEscape.toAttributeValue(char[], int, int).

Specified by:
toElementText in interface XMLEscape
Parameters:
value - The value that needs to be text-escaped.
Returns:
A well-formed value for the text node.
See Also:
XMLEscape.toAttributeValue(String)

getEncoding

public final String getEncoding()
Returns the encoding used.

Specified by:
getEncoding in interface XMLEscape
Returns:
The encoding used by the implementing class.
See Also:
XMLEscape.getEncoding()