Class XmlEscapeSymbols
Instances of this class group all the complex data structures needed to support escape and unescape operations for XML.
In contrast with HTML escape operations, the entity references to be used for XML escape/unescape operations can be defined by the user by manually creating an instance of this class containing all the entities he/she wants to escape.
It is not recommended to use this XML class for HTML escape/unescape operations. Use the methods
in HtmlEscape
instead, as HTML escape rules include a series of tweaks not allowed in
XML, as well as being less lenient with regard to aspects such as case-sensitivity. Besides, the HTML escape
infrastructure is able to apply a series of performance optimizations not possible in XML due to the fact that
the number of HTML Character Entity References (Named Character References in HTML5 jargon) is fixed
and known in advance.
Objects of this class are thread-safe.
- Since:
- 1.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
(package private) static final class
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final XmlCodepointValidator
(package private) final byte[]
(package private) static final char
(package private) final char[][]
(package private) final char[][]
(package private) final int[]
(package private) final int[]
(package private) static final XmlEscapeSymbols
(package private) static final XmlEscapeSymbols
(package private) static final XmlEscapeSymbols
(package private) static final XmlEscapeSymbols
-
Constructor Summary
ConstructorsConstructorDescriptionXmlEscapeSymbols
(XmlEscapeSymbols.References references, byte[] escapeLevels, XmlCodepointValidator codepointValidator) -
Method Summary
Modifier and TypeMethodDescription(package private) static int
binarySearch
(char[][] values, char[] text, int start, int end) (package private) static int
binarySearch
(char[][] values, String text, int start, int end) private static int
compare
(char[] cer, char[] text, int start, int end) private static int
-
Field Details
-
XML10_SYMBOLS
-
XML11_SYMBOLS
-
XML10_ATTRIBUTE_SYMBOLS
-
XML11_ATTRIBUTE_SYMBOLS
-
LEVELS_LEN
static final char LEVELS_LEN- See Also:
-
ESCAPE_LEVELS
final byte[] ESCAPE_LEVELS -
SORTED_CODEPOINTS
final int[] SORTED_CODEPOINTS -
SORTED_CERS_BY_CODEPOINT
final char[][] SORTED_CERS_BY_CODEPOINT -
SORTED_CERS
final char[][] SORTED_CERS -
SORTED_CODEPOINTS_BY_CER
final int[] SORTED_CODEPOINTS_BY_CER -
CODEPOINT_VALIDATOR
-
-
Constructor Details
-
XmlEscapeSymbols
XmlEscapeSymbols(XmlEscapeSymbols.References references, byte[] escapeLevels, XmlCodepointValidator codepointValidator)
-
-
Method Details
-
compare
-
compare
private static int compare(char[] cer, char[] text, int start, int end) -
binarySearch
-
binarySearch
static int binarySearch(char[][] values, char[] text, int start, int end)
-