Class XMLEscapeASCII
- All Implemented Interfaces:
XMLEscape
- Version:
- 16 January 2007
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidDoes nothing.toAttributeValue(char[] ch, int off, int len) Replaces '<', '&', '"' and '\'' as well an any character that is not part of the standard unicode range.toElementText(char[] ch, int off, int len) Replace characters which are invalid in element values, by the corresponding entity in a givenString.Methods inherited from class com.topologi.diffx.xml.esc.XMLEscapeBase
getEncoding, toAttributeValue, toElementTextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.topologi.diffx.xml.esc.XMLEscape
getEncoding, toAttributeValue, toElementText
-
Field Details
-
ASCII_ESCAPE
A static instance of the UTF8 escape class. -
ENCODING
The encoding used for this instance.- See Also:
-
-
Constructor Details
-
XMLEscapeASCII
private XMLEscapeASCII()Prevent creation of instances
-
-
Method Details
-
toAttributeValue
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]Returns a well-formed attribute value.This method must replace any character in the specified value by the corresponding numeric character reference or the predefined XML general entities, if the character is not allowed or not in the encoding range.
Attribute values must not contain '&' or '<. Quotes and apostrophes must also be escaped by """ and "'" respectively.
- Specified by:
toAttributeValuein interfaceXMLEscape- 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.
-
toElementText
Replace characters which are invalid in element values, by the corresponding entity in a givenString.these characters are:
- '&' by the ampersand entity "&"
- '<' by the entity "<"
Empty strings or
nullreturn respectively "" andnull.Note: this function assumes that there are no entities in the given String. If there are existing entities, then the ampersand character will be escaped by the ampersand entity. Returns a well-formed text value for the element.
This method must replace any character in the specified value by the corresponding numeric character reference or the predefined XML general entities, if the character is not allowed or not in the encoding range.
The text of an element must not contain '&' or '<.
- Specified by:
toElementTextin interfaceXMLEscape- 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 text node.
-
doNothing
private void doNothing()Does nothing.
-