Class XmlEscapeSymbols
- java.lang.Object
-
- org.unbescape.xml.XmlEscapeSymbols
-
final class XmlEscapeSymbols extends java.lang.Object
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 Classes Modifier and Type Class Description private static class
XmlEscapeSymbols.Reference
(package private) static class
XmlEscapeSymbols.References
-
Field Summary
Fields Modifier and Type Field Description (package private) XmlCodepointValidator
CODEPOINT_VALIDATOR
(package private) byte[]
ESCAPE_LEVELS
(package private) static char
LEVELS_LEN
(package private) char[][]
SORTED_CERS
(package private) char[][]
SORTED_CERS_BY_CODEPOINT
(package private) int[]
SORTED_CODEPOINTS
(package private) int[]
SORTED_CODEPOINTS_BY_CER
(package private) static XmlEscapeSymbols
XML10_ATTRIBUTE_SYMBOLS
(package private) static XmlEscapeSymbols
XML10_SYMBOLS
(package private) static XmlEscapeSymbols
XML11_ATTRIBUTE_SYMBOLS
(package private) static XmlEscapeSymbols
XML11_SYMBOLS
-
Constructor Summary
Constructors Constructor Description XmlEscapeSymbols(XmlEscapeSymbols.References references, byte[] escapeLevels, XmlCodepointValidator codepointValidator)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static int
binarySearch(char[][] values, char[] text, int start, int end)
(package private) static int
binarySearch(char[][] values, java.lang.String text, int start, int end)
private static int
compare(char[] cer, char[] text, int start, int end)
private static int
compare(char[] cer, java.lang.String text, int start, int end)
-
-
-
Field Detail
-
XML10_SYMBOLS
static final XmlEscapeSymbols XML10_SYMBOLS
-
XML11_SYMBOLS
static final XmlEscapeSymbols XML11_SYMBOLS
-
XML10_ATTRIBUTE_SYMBOLS
static final XmlEscapeSymbols XML10_ATTRIBUTE_SYMBOLS
-
XML11_ATTRIBUTE_SYMBOLS
static final XmlEscapeSymbols XML11_ATTRIBUTE_SYMBOLS
-
LEVELS_LEN
static final char LEVELS_LEN
- See Also:
- Constant Field Values
-
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
final XmlCodepointValidator CODEPOINT_VALIDATOR
-
-
Constructor Detail
-
XmlEscapeSymbols
XmlEscapeSymbols(XmlEscapeSymbols.References references, byte[] escapeLevels, XmlCodepointValidator codepointValidator)
-
-
Method Detail
-
compare
private static int compare(char[] cer, java.lang.String text, int start, int end)
-
compare
private static int compare(char[] cer, char[] text, int start, int end)
-
binarySearch
static int binarySearch(char[][] values, java.lang.String text, int start, int end)
-
binarySearch
static int binarySearch(char[][] values, char[] text, int start, int end)
-
-