Class XmlCharacters

java.lang.Object
io.debezium.text.XmlCharacters

@Immutable public class XmlCharacters extends Object
A utility class for determining the validity of various XML names, per the XML 1.0 Specification.
Author:
Randall Hauch
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final int
     
    private static final char[]
    This implementation uses an array that captures for each character the XML classifications.
    private static final int
     
    private static final int
     
    private static final int
     
    private static final int
     
    private static final int
     
    private static final int
     
    private static final int
     
    private static final int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isValid(int c)
    Determine whether the supplied character is a valid character in XML.
    static boolean
    Determine whether the supplied character is a valid character in XML content
    static boolean
    isValidName(int c)
    Determine whether the supplied character is a valid non-first character in an XML Name.
    static boolean
    Determine if the supplied name is a valid XML Name.
    static boolean
    Determine whether the supplied character is a valid first character in an XML Name.
    static boolean
    Determine whether the supplied character is a valid non-first character in an XML NCName.
    static boolean
    Determine if the supplied name is a valid XML NCName.
    static boolean
    Determine whether the supplied character is a valid first character in an XML NCName.
    static boolean
    isValidPubid(int c)
    Determine whether the supplied character is a valid character in an XML Pubid.
    static boolean
    isValidSpace(int c)
    Determine whether the supplied character is a valid whitespace character in XML

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NUMBER_OF_CHARACTERS

      private static final int NUMBER_OF_CHARACTERS
      See Also:
    • MASKS

      private static final char[] MASKS
      This implementation uses an array that captures for each character the XML classifications. An array is used because it is a fast way of looking up each character.
    • VALID_CHARACTER

      private static final int VALID_CHARACTER
      See Also:
    • CONTENT_CHARACTER

      private static final int CONTENT_CHARACTER
      See Also:
    • SPACE_CHARACTER

      private static final int SPACE_CHARACTER
      See Also:
    • NAME_START_CHARACTER

      private static final int NAME_START_CHARACTER
      See Also:
    • NAME_CHARACTER

      private static final int NAME_CHARACTER
      See Also:
    • NCNAME_START_CHARACTER

      private static final int NCNAME_START_CHARACTER
      See Also:
    • NCNAME_CHARACTER

      private static final int NCNAME_CHARACTER
      See Also:
    • PUBID_CHARACTER

      private static final int PUBID_CHARACTER
      See Also:
  • Constructor Details

    • XmlCharacters

      private XmlCharacters()
  • Method Details

    • isValidNameStart

      public static boolean isValidNameStart(int c)
      Determine whether the supplied character is a valid first character in an XML Name. The first character in an XML name is more restrictive than the remaining characters.
      Parameters:
      c - the character
      Returns:
      true if the character is valid for an XML Name's first character
    • isValidNcNameStart

      public static boolean isValidNcNameStart(int c)
      Determine whether the supplied character is a valid first character in an XML NCName. The first character in an XML NCName is more restrictive than the remaining characters.
      Parameters:
      c - the character
      Returns:
      true if the character is valid for an XML NCName's first character
    • isValidName

      public static boolean isValidName(int c)
      Determine whether the supplied character is a valid non-first character in an XML Name. The first character in an XML name is more restrictive than the remaining characters.
      Parameters:
      c - the character
      Returns:
      true if the character is valid character in an XML Name
    • isValidNcName

      public static boolean isValidNcName(int c)
      Determine whether the supplied character is a valid non-first character in an XML NCName. The first character in an XML NCName is more restrictive than the remaining characters.
      Parameters:
      c - the character
      Returns:
      true if the character is valid character in an XML NCName
    • isValidPubid

      public static boolean isValidPubid(int c)
      Determine whether the supplied character is a valid character in an XML Pubid.
      Parameters:
      c - the character
      Returns:
      true if the character is valid character in an XML Pubid
    • isValid

      public static boolean isValid(int c)
      Determine whether the supplied character is a valid character in XML.
      Parameters:
      c - the character
      Returns:
      true if the character is valid character in XML
    • isValidContent

      public static boolean isValidContent(int c)
      Determine whether the supplied character is a valid character in XML content
      Parameters:
      c - the character
      Returns:
      true if the character is valid character in XML content
    • isValidSpace

      public static boolean isValidSpace(int c)
      Determine whether the supplied character is a valid whitespace character in XML
      Parameters:
      c - the character
      Returns:
      true if the character is valid whitespace character in XML
    • isValidName

      public static boolean isValidName(String name)
      Determine if the supplied name is a valid XML Name.
      Parameters:
      name - the string being checked
      Returns:
      true if the supplied name is indeed a valid XML Name, or false otherwise
    • isValidNcName

      public static boolean isValidNcName(String name)
      Determine if the supplied name is a valid XML NCName.
      Parameters:
      name - the string being checked
      Returns:
      true if the supplied name is indeed a valid XML NCName, or false otherwise