Package io.debezium.text
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 int
CONTENT_CHARACTER
private static char[]
MASKS
This implementation uses an array that captures for each character the XML classifications.private static int
NAME_CHARACTER
private static int
NAME_START_CHARACTER
private static int
NCNAME_CHARACTER
private static int
NCNAME_START_CHARACTER
private static int
NUMBER_OF_CHARACTERS
private static int
PUBID_CHARACTER
private static int
SPACE_CHARACTER
private static int
VALID_CHARACTER
-
Constructor Summary
Constructors Modifier Constructor Description private
XmlCharacters()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isValid(int c)
Determine whether the supplied character is a valid character in XML.static boolean
isValidContent(int c)
Determine whether the supplied character is a valid character in XML contentstatic boolean
isValidName(int c)
Determine whether the supplied character is a valid non-first character in an XML Name.static boolean
isValidName(String name)
Determine if the supplied name is a valid XML Name.static boolean
isValidNameStart(int c)
Determine whether the supplied character is a valid first character in an XML Name.static boolean
isValidNcName(int c)
Determine whether the supplied character is a valid non-first character in an XML NCName.static boolean
isValidNcName(String name)
Determine if the supplied name is a valid XML NCName.static boolean
isValidNcNameStart(int c)
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
-
-
-
Field Detail
-
NUMBER_OF_CHARACTERS
private static final int NUMBER_OF_CHARACTERS
- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
CONTENT_CHARACTER
private static final int CONTENT_CHARACTER
- See Also:
- Constant Field Values
-
SPACE_CHARACTER
private static final int SPACE_CHARACTER
- See Also:
- Constant Field Values
-
NAME_START_CHARACTER
private static final int NAME_START_CHARACTER
- See Also:
- Constant Field Values
-
NAME_CHARACTER
private static final int NAME_CHARACTER
- See Also:
- Constant Field Values
-
NCNAME_START_CHARACTER
private static final int NCNAME_START_CHARACTER
- See Also:
- Constant Field Values
-
NCNAME_CHARACTER
private static final int NCNAME_CHARACTER
- See Also:
- Constant Field Values
-
PUBID_CHARACTER
private static final int PUBID_CHARACTER
- See Also:
- Constant Field Values
-
-
Method Detail
-
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 theremaining 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 theremaining 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. Thefirst 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. Thefirst 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
-
-