Class XMLChar
- java.lang.Object
-
- org.htmlunit.cyberneko.xerces.util.XMLChar
-
public final class XMLChar extends java.lang.Object
This class defines the basic XML character properties. The data in this class can be used to verify that a character is a valid XML character or if the character is a space, name start, or name character.A series of convenience methods are supplied to ease the burden of the developer. Because inlining the checks can improve per character performance, the tables of character properties are public. Using the character as an index into the
CHARS
array and applying the appropriate mask flag (e.g.MASK_VALID
), yields the same results as calling the convenience methods. There is one exception: check the comments for theisValid
method for details.
-
-
Field Summary
Fields Modifier and Type Field Description private static byte[]
CHARS
Character flags.static int
MASK_NAME
Name character mask.static int
MASK_NAME_START
Name start character mask.static int
MASK_NCNAME
NCName character mask.static int
MASK_NCNAME_START
NCName start character mask.
-
Constructor Summary
Constructors Modifier Constructor Description private
XMLChar()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isLowSurrogate(int c)
static boolean
isName(int c)
static boolean
isNameStart(int c)
static boolean
isNCName(int c)
static boolean
isNCNameStart(int c)
static boolean
isValidName(java.lang.String name)
Check to see if a string is a valid Name according to [5] in the XML 1.0 Recommendationstatic boolean
isValidNCName(java.lang.String ncName)
Check to see if a string is a valid NCName according to [4] from the XML Namespaces 1.0 Recommendationstatic int
supplemental(char h, char l)
-
-
-
Field Detail
-
CHARS
private static final byte[] CHARS
Character flags.
-
MASK_NAME_START
public static final int MASK_NAME_START
Name start character mask.- See Also:
- Constant Field Values
-
MASK_NAME
public static final int MASK_NAME
Name character mask.- See Also:
- Constant Field Values
-
MASK_NCNAME_START
public static final int MASK_NCNAME_START
NCName start character mask.- See Also:
- Constant Field Values
-
MASK_NCNAME
public static final int MASK_NCNAME
NCName character mask.- See Also:
- Constant Field Values
-
-
Method Detail
-
supplemental
public static int supplemental(char h, char l)
- Parameters:
h
- The high surrogate.l
- The low surrogate.- Returns:
- true the supplemental character corresponding to the given surrogates.
-
isLowSurrogate
public static boolean isLowSurrogate(int c)
- Parameters:
c
- The character to check.- Returns:
- whether the given character is a low surrogate
-
isNameStart
public static boolean isNameStart(int c)
- Parameters:
c
- The character to check.- Returns:
- true if the specified character is a valid name start character as defined by production [5] in the XML 1.0 specification.
-
isName
public static boolean isName(int c)
- Parameters:
c
- The character to check.- Returns:
- true if the specified character is a valid name character as defined by production [4] in the XML 1.0 specification.
-
isNCNameStart
public static boolean isNCNameStart(int c)
- Parameters:
c
- The character to check.- Returns:
- true if the specified character is a valid NCName start character as defined by production [4] in Namespaces in XML recommendation.
-
isNCName
public static boolean isNCName(int c)
- Parameters:
c
- The character to check.- Returns:
- true if the specified character is a valid NCName character as defined by production [5] in Namespaces in XML recommendation.
-
isValidName
public static boolean isValidName(java.lang.String name)
Check to see if a string is a valid Name according to [5] in the XML 1.0 Recommendation- Parameters:
name
- string to check- Returns:
- true if name is a valid Name
-
isValidNCName
public static boolean isValidNCName(java.lang.String ncName)
Check to see if a string is a valid NCName according to [4] from the XML Namespaces 1.0 Recommendation- Parameters:
ncName
- string to check- Returns:
- true if name is a valid NCName
-
-