java.lang.Object
org.htmlunit.cyberneko.xerces.util.XMLChar
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 the
isValid method for details.
- Author:
- Glenn Marcy, IBM, Andy Clark, IBM, Eric Ye, IBM, Arnaud Le Hors, IBM, Michael Glavassevich, IBM, Rahul Srivastava, Sun Microsystems Inc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intName character mask.static final intName start character mask.static final intNCName character mask.static final intNCName start character mask. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisLowSurrogate(int c) Returns whether the given character or code point is a low surrogate.static booleanisName(int c) Returns whether the specified character is a valid name character as defined by production [4] in the XML 1.0 specification.static booleanisNameStart(int c) Returns whether the specified character is a valid name start character as defined by production [5] in the XML 1.0 specification.static booleanisNCName(int c) Returns whether the specified character is a valid NCName character as defined by production [5] in the Namespaces in XML recommendation.static booleanisNCNameStart(int c) Returns whether the specified character is a valid NCName start character as defined by production [4] in the Namespaces in XML recommendation.static booleanisValidName(String name) Checks whether a string is a valid Name according to production [5] in the XML 1.0 Recommendation.static booleanisValidNCName(String ncName) Checks whether a string is a valid NCName according to production [4] from the XML Namespaces 1.0 Recommendation.static intsupplemental(char h, char l) Returns the supplemental character corresponding to the given surrogate pair.
-
Field Details
-
MASK_NAME_START
public static final int MASK_NAME_STARTName start character mask.- See Also:
-
MASK_NAME
public static final int MASK_NAMEName character mask.- See Also:
-
MASK_NCNAME_START
public static final int MASK_NCNAME_STARTNCName start character mask.- See Also:
-
MASK_NCNAME
public static final int MASK_NCNAMENCName character mask.- See Also:
-
-
Method Details
-
supplemental
public static int supplemental(char h, char l) Returns the supplemental character corresponding to the given surrogate pair.- Parameters:
h- the high surrogate characterl- the low surrogate character- Returns:
- the corresponding supplemental character code point
-
isLowSurrogate
public static boolean isLowSurrogate(int c) Returns whether the given character or code point is a low surrogate.- Parameters:
c- the character or code point to check- Returns:
trueif the character is a low surrogate,falseotherwise
-
isNameStart
public static boolean isNameStart(int c) Returns whether the specified character is a valid name start character as defined by production [5] in the XML 1.0 specification.- Parameters:
c- the character code point to check- Returns:
trueif the character is a valid name start character,falseotherwise
-
isName
public static boolean isName(int c) Returns whether the specified character is a valid name character as defined by production [4] in the XML 1.0 specification.- Parameters:
c- the character code point to check- Returns:
trueif the character is a valid name character,falseotherwise
-
isNCNameStart
public static boolean isNCNameStart(int c) Returns whether the specified character is a valid NCName start character as defined by production [4] in the Namespaces in XML recommendation.- Parameters:
c- the character code point to check- Returns:
trueif the character is a valid NCName start character,falseotherwise
-
isNCName
public static boolean isNCName(int c) Returns whether the specified character is a valid NCName character as defined by production [5] in the Namespaces in XML recommendation.- Parameters:
c- the character code point to check- Returns:
trueif the character is a valid NCName character,falseotherwise
-
isValidName
Checks whether a string is a valid Name according to production [5] in the XML 1.0 Recommendation.- Parameters:
name- the string to check- Returns:
trueif the string is a valid Name,falseotherwise
-
isValidNCName
Checks whether a string is a valid NCName according to production [4] from the XML Namespaces 1.0 Recommendation.- Parameters:
ncName- the string to check]- Returns:
trueif the string is a valid NCName,falseotherwise
-