Class XmlEscapeSymbols

java.lang.Object
org.unbescape.xml.XmlEscapeSymbols

final class XmlEscapeSymbols extends 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
  • Field Details

    • 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:
    • 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 Details

  • Method Details

    • compare

      private static int compare(char[] cer, 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, String text, int start, int end)
    • binarySearch

      static int binarySearch(char[][] values, char[] text, int start, int end)