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 intCONTENT_CHARACTERprivate static char[]MASKSThis implementation uses an array that captures for each character the XML classifications.private static intNAME_CHARACTERprivate static intNAME_START_CHARACTERprivate static intNCNAME_CHARACTERprivate static intNCNAME_START_CHARACTERprivate static intNUMBER_OF_CHARACTERSprivate static intPUBID_CHARACTERprivate static intSPACE_CHARACTERprivate static intVALID_CHARACTER
-
Constructor Summary
Constructors Modifier Constructor Description privateXmlCharacters()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisValid(int c)Determine whether the supplied character is a valid character in XML.static booleanisValidContent(int c)Determine whether the supplied character is a valid character in XML contentstatic booleanisValidName(int c)Determine whether the supplied character is a valid non-first character in an XML Name.static booleanisValidName(String name)Determine if the supplied name is a valid XML Name.static booleanisValidNameStart(int c)Determine whether the supplied character is a valid first character in an XML Name.static booleanisValidNcName(int c)Determine whether the supplied character is a valid non-first character in an XML NCName.static booleanisValidNcName(String name)Determine if the supplied name is a valid XML NCName.static booleanisValidNcNameStart(int c)Determine whether the supplied character is a valid first character in an XML NCName.static booleanisValidPubid(int c)Determine whether the supplied character is a valid character in an XML Pubid.static booleanisValidSpace(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 characterin 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 characterin 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
-
-