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.
Modifier and Type | Field and Description |
---|---|
private static final byte[] | CHARS
Character flags. |
public static final int | MASK_CONTENT
Content character mask. |
public static final int | MASK_NAME
Name character mask. |
public static final int | MASK_NAME_START
Name start character mask. |
public static final int | MASK_NCNAME
NCName character mask. |
public static final int | MASK_NCNAME_START
NCName start character mask. |
public static final int | MASK_PUBID
Pubid character mask. |
public static final int | MASK_SPACE
Space character mask. |
public static final int | MASK_VALID
Valid character mask. |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public static char | highSurrogate(int
The supplemental character to "split". c)Returns the high surrogate of a supplemental character |
public static boolean | isContent(int
The character to check. c)Returns true if the specified character can be considered content. |
public static boolean | isHighSurrogate(int
The character to check. c)Returns whether the given character is a high surrogate |
public static boolean | |
public static boolean | |
public static boolean | isMarkup(int
The character to check. c)Returns true if the specified character can be considered markup. |
public static boolean | isName(int
The character to check. c)Returns true if the specified character is a valid name character as defined by production [4] in the XML 1.0 specification. |
public static boolean | isNameStart(int
The character to check. c)Returns true if the specified character is a valid name start character as defined by production [5] in the XML 1.0 specification. |
public static boolean | isNCName(int
The character to check. c)Returns true if the specified character is a valid NCName character as defined by production [5] in Namespaces in XML recommendation. |
public static boolean | isNCNameStart(int
The character to check. c)Returns true if the specified character is a valid NCName start character as defined by production [4] in Namespaces in XML recommendation. |
public static boolean | isPubid(int
The character to check. c)Returns true if the specified character is a valid Pubid character as defined by production [13] in the XML 1.0 specification. |
public static boolean | isSpace(int
The character to check. c)Returns true if the specified character is a space character as defined by production [3] in the XML 1.0 specification. |
public static boolean | isSupplemental(int
The character to check. c)Returns true if the specified character is a supplemental character. |
public static boolean | |
public static boolean | isValidIANAEncoding(String
The IANA encoding name. ianaEncoding)Returns true if the encoding name is a valid IANA encoding. |
public static boolean | isValidJavaEncoding(String
The Java encoding name. javaEncoding)Returns true if the encoding name is a valid Java encoding. |
public static boolean | Returns: true if name is a valid Namestring to check name)Check to see if a string is a valid Name according to [5] in the XML 1.0 Recommendation |
public static boolean | Returns: true if name is a valid NCNamestring to check ncName)Check to see if a string is a valid NCName according to [4] from the XML Namespaces 1.0 Recommendation |
public static boolean | Returns: true if nmtoken is a valid Nmtokenstring to check nmtoken)Check to see if a string is a valid Nmtoken according to [7] in the XML 1.0 Recommendation |
public static char | lowSurrogate(int
The supplemental character to "split". c)Returns the low surrogate of a supplemental character |
public static int | supplemental(char
The high surrogate. h, char The low surrogate. l)Returns true the supplemental character corresponding to the given surrogates. |
public static String |
CHARS | back to summary |
---|---|
private static final byte[] CHARS Character flags. |
MASK_CONTENT | back to summary |
---|---|
public static final int MASK_CONTENT Content character mask. Special characters are those that can be considered the start of markup, such as '<' and '&'. The various newline characters are considered special as well. All other valid XML characters can be considered content. This is an optimization for the inner loop of character scanning. |
MASK_NAME | back to summary |
---|---|
public static final int MASK_NAME Name character mask. |
MASK_NAME_START | back to summary |
---|---|
public static final int MASK_NAME_START Name start character mask. |
MASK_NCNAME | back to summary |
---|---|
public static final int MASK_NCNAME NCName character mask. |
MASK_NCNAME_START | back to summary |
---|---|
public static final int MASK_NCNAME_START NCName start character mask. |
MASK_PUBID | back to summary |
---|---|
public static final int MASK_PUBID Pubid character mask. |
MASK_SPACE | back to summary |
---|---|
public static final int MASK_SPACE Space character mask. |
MASK_VALID | back to summary |
---|---|
public static final int MASK_VALID Valid character mask. |
XMLChar | back to summary |
---|---|
public XMLChar() |
highSurrogate | back to summary |
---|---|
public static char highSurrogate(int c) Returns the high surrogate of a supplemental character
|
isContent | back to summary |
---|---|
public static boolean isContent(int c) Returns true if the specified character can be considered content.
|
isHighSurrogate | back to summary |
---|---|
public static boolean isHighSurrogate(int c) Returns whether the given character is a high surrogate
|
isInvalid | back to summary |
---|---|
public static boolean isInvalid(int c) Returns true if the specified character is invalid.
|
isLowSurrogate | back to summary |
---|---|
public static boolean isLowSurrogate(int c) Returns whether the given character is a low surrogate
|
isMarkup | back to summary |
---|---|
public static boolean isMarkup(int c) Returns true if the specified character can be considered markup. Markup characters include '<', '&', and '%'.
|
isName | back to summary |
---|---|
public static boolean isName(int c) Returns true if the specified character is a valid name character as defined by production [4] in the XML 1.0 specification.
|
isNameStart | back to summary |
---|---|
public static boolean isNameStart(int c) Returns true if the specified character is a valid name start character as defined by production [5] in the XML 1.0 specification.
|
isNCName | back to summary |
---|---|
public static boolean isNCName(int c) Returns true if the specified character is a valid NCName character as defined by production [5] in Namespaces in XML recommendation.
|
isNCNameStart | back to summary |
---|---|
public static boolean isNCNameStart(int c) Returns true if the specified character is a valid NCName start character as defined by production [4] in Namespaces in XML recommendation.
|
isPubid | back to summary |
---|---|
public static boolean isPubid(int c) Returns true if the specified character is a valid Pubid character as defined by production [13] in the XML 1.0 specification.
|
isSpace | back to summary |
---|---|
public static boolean isSpace(int c) Returns true if the specified character is a space character as defined by production [3] in the XML 1.0 specification.
|
isSupplemental | back to summary |
---|---|
public static boolean isSupplemental(int c) Returns true if the specified character is a supplemental character.
|
isValid | back to summary |
---|---|
public static boolean isValid(int c) Returns true if the specified character is valid. This method also checks the surrogate character range from 0x10000 to 0x10FFFF.
If the program chooses to apply the mask directly to the
|
isValidIANAEncoding | back to summary |
---|---|
public static boolean isValidIANAEncoding(String ianaEncoding) Returns true if the encoding name is a valid IANA encoding. This method does not verify that there is a decoder available for this encoding, only that the characters are valid for an IANA encoding name.
|
isValidJavaEncoding | back to summary |
---|---|
public static boolean isValidJavaEncoding(String javaEncoding) Returns true if the encoding name is a valid Java encoding. This method does not verify that there is a decoder available for this encoding, only that the characters are valid for an Java encoding name.
|
isValidName | back to summary |
---|---|
public static boolean isValidName(String name) Check to see if a string is a valid Name according to [5] in the XML 1.0 Recommendation
|
isValidNCName | back to summary |
---|---|
public static boolean isValidNCName(String ncName) Check to see if a string is a valid NCName according to [4] from the XML Namespaces 1.0 Recommendation
|
isValidNmtoken | back to summary |
---|---|
public static boolean isValidNmtoken(String nmtoken) Check to see if a string is a valid Nmtoken according to [7] in the XML 1.0 Recommendation
|
lowSurrogate | back to summary |
---|---|
public static char lowSurrogate(int c) Returns the low surrogate of a supplemental character
|
supplemental | back to summary |
---|---|
public static int supplemental(char h, char l) Returns true the supplemental character corresponding to the given surrogates.
|
trim | back to summary |
---|---|
public static String trim(String value) Trims space characters as defined by production [3] in the XML 1.0 specification from both ends of the given string. |