public class XMLChar extends Object
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 |
|---|---|
static int |
MASK_CONTENT
Content character mask.
|
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.
|
static int |
MASK_PUBID
Pubid character mask.
|
static int |
MASK_SPACE
Space character mask.
|
static int |
MASK_VALID
Valid character mask.
|
| Constructor and Description |
|---|
XMLChar() |
| Modifier and Type | Method and Description |
|---|---|
static char |
highSurrogate(int c) |
static boolean |
isContent(int c) |
static boolean |
isHighSurrogate(int c) |
static boolean |
isInvalid(int c) |
static boolean |
isLowSurrogate(int c) |
static boolean |
isMarkup(int c) |
static boolean |
isName(int c) |
static boolean |
isNameStart(int c) |
static boolean |
isNCName(int c) |
static boolean |
isNCNameStart(int c) |
static boolean |
isPubid(int c) |
static boolean |
isSpace(int c) |
static boolean |
isSupplemental(int c) |
static boolean |
isValid(int c) |
static boolean |
isValidIANAEncoding(String ianaEncoding) |
static boolean |
isValidJavaEncoding(String javaEncoding) |
static boolean |
isValidName(String name)
Check to see if a string is a valid Name according to [5]
in the XML 1.0 Recommendation
|
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
|
static boolean |
isValidNmtoken(String nmtoken)
Check to see if a string is a valid Nmtoken according to [7]
in the XML 1.0 Recommendation
|
static char |
lowSurrogate(int c) |
static int |
supplemental(char h,
char l) |
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.
|
public static final int MASK_VALID
public static final int MASK_SPACE
public static final int MASK_NAME_START
public static final int MASK_NAME
public static final int MASK_PUBID
public static final int MASK_CONTENT
This is an optimization for the inner loop of character scanning.
public static final int MASK_NCNAME_START
public static final int MASK_NCNAME
public static boolean isSupplemental(int c)
c - The character to check.public static int supplemental(char h,
char l)
h - The high surrogate.l - The low surrogate.public static char highSurrogate(int c)
c - The supplemental character to "split".public static char lowSurrogate(int c)
c - The supplemental character to "split".public static boolean isHighSurrogate(int c)
c - The character to check.public static boolean isLowSurrogate(int c)
c - The character to check.public static boolean isValid(int c)
c - The character to check.
If the program chooses to apply the mask directly to the
CHARS array, then they are responsible for checking
the surrogate character range.
public static boolean isInvalid(int c)
c - The character to check.public static boolean isContent(int c)
c - The character to check.public static boolean isMarkup(int c)
c - The character to check.public static boolean isSpace(int c)
c - The character to check.public static boolean isNameStart(int c)
c - The character to check.public static boolean isName(int c)
c - The character to check.public static boolean isNCNameStart(int c)
c - The character to check.public static boolean isNCName(int c)
c - The character to check.public static boolean isPubid(int c)
c - The character to check.public static boolean isValidName(String name)
name - string to checkpublic static boolean isValidNCName(String ncName)
ncName - string to checkpublic static boolean isValidNmtoken(String nmtoken)
nmtoken - string to checkpublic static boolean isValidIANAEncoding(String ianaEncoding)
ianaEncoding - The IANA encoding name.public static boolean isValidJavaEncoding(String javaEncoding)
javaEncoding - The Java encoding name.Copyright © 2023 Gargoyle Software Inc.. All rights reserved.