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 author: Andy Clark, IBM author: Eric Ye, IBM author: Arnaud Le Hors, IBM author: Michael Glavassevich, IBM author: Rahul Srivastava, Sun Microsystems Inc. version: $Id: XMLChar.java,v 1.2 2006/04/01 06:01:40 jeffsuttor Exp $
isMarkup(int c) Returns true if the specified character can be considered markup.
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.
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.
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.
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.
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.
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.
public static boolean
isSupplemental(int c) Returns true if the specified character is a supplemental character.
public static boolean
isValid(int c) Returns true if the specified character is valid.
public static boolean
isValidIANAEncoding(String ianaEncoding) Returns true if the encoding name is a valid IANA encoding.
public static boolean
isValidJavaEncoding(String javaEncoding) Returns true if the encoding name is a valid Java encoding.
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.
Returns true if the specified character is a valid NCName
character as defined by production [5] in Namespaces in XML
recommendation.
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.
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.
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.
Parameters: c - The character to check.
Returns true if the specified character is a valid Pubid
character as defined by production [13] in the XML 1.0
specification.
Parameters: c - The character to check.
Returns true if the specified character is a space character
as defined by production [3] in the XML 1.0 specification.
Parameters: c - The character to check.
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
CHARS array, then they are responsible for checking
the surrogate character range.
Parameters: c - The character to check.
isValidIANAEncoding
public static boolean isValidIANAEncoding(String ianaEncoding)(Code)
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.
Parameters: ianaEncoding - The IANA encoding name.
isValidJavaEncoding
public static boolean isValidJavaEncoding(String javaEncoding)(Code)
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.
Parameters: javaEncoding - The Java encoding name.
isValidNCName
public static boolean isValidNCName(String ncName)(Code)
Check to see if a string is a valid NCName according to [4]
from the XML Namespaces 1.0 Recommendation
Parameters: name - string to check true if name is a valid NCName
isValidName
public static boolean isValidName(String name)(Code)
Check to see if a string is a valid Name according to [5]
in the XML 1.0 Recommendation
Parameters: name - string to check true if name is a valid Name
isValidNmtoken
public static boolean isValidNmtoken(String nmtoken)(Code)
Check to see if a string is a valid Nmtoken according to [7]
in the XML 1.0 Recommendation
Parameters: nmtoken - string to check true if nmtoken is a valid Nmtoken