java.lang.Object
org.xbib.content.xml.util.XML11Char
This class defines the basic properties of characters in XML 1.1. The data
in this class can be used to verify that a character is a valid
XML 1.1 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. Using the character as an index into the
XML11CHARS
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.
Taken from org.apache.xerces.util.XML11Char.java-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intXML 1.1 Name character mask.static final intXML 1.1 Name start character mask.static final intXML namespaces 1.1 NCName.static final intXML namespaces 1.1 NCNameStart. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisLowSurrogate(int c) Returns whether the given character is a low surrogate.static booleanisXML11Name(int c) Returns true if the specified character is a valid name character as defined by production [4a] in the XML 1.1 specification.static booleanisXML11NameHighSurrogate(int c) Returns whether the given character is a valid high surrogate for a name character.static booleanisXML11NameStart(int c) Returns true if the specified character is a valid name start character as defined by production [4] in the XML 1.1 specification.static booleanisXML11NCName(int c) Returns true if the specified character is a valid NCName character as defined by production [5] in Namespaces in XML 1.1 recommendation.static booleanisXML11NCNameStart(int c) Returns true if the specified character is a valid NCName start character as defined by production [4] in Namespaces in XML 1.1 recommendation.static booleanisXML11ValidName(String name) Check to see if a string is a valid XML Name.static intsupplemental(char h, char l) Returns the supplemental character corresponding to the given surrogates.
-
Field Details
-
MASK_XML11_NAME_START
public static final int MASK_XML11_NAME_STARTXML 1.1 Name start character mask.- See Also:
-
MASK_XML11_NAME
public static final int MASK_XML11_NAMEXML 1.1 Name character mask.- See Also:
-
MASK_XML11_NCNAME_START
public static final int MASK_XML11_NCNAME_STARTXML namespaces 1.1 NCNameStart.- See Also:
-
MASK_XML11_NCNAME
public static final int MASK_XML11_NCNAMEXML namespaces 1.1 NCName.- See Also:
-
-
Constructor Details
-
XML11Char
public XML11Char()
-
-
Method Details
-
isXML11NameStart
public static boolean isXML11NameStart(int c) Returns true if the specified character is a valid name start character as defined by production [4] in the XML 1.1 specification.- Parameters:
c- The character to check.- Returns:
- true if character is valid names start character
-
isXML11Name
public static boolean isXML11Name(int c) Returns true if the specified character is a valid name character as defined by production [4a] in the XML 1.1 specification.- Parameters:
c- The character to check.- Returns:
- true if character is valid name character
-
isXML11NCNameStart
public static boolean isXML11NCNameStart(int c) Returns true if the specified character is a valid NCName start character as defined by production [4] in Namespaces in XML 1.1 recommendation.- Parameters:
c- The character to check.- Returns:
- true if character is valid namespace classified name start character
-
isXML11NCName
public static boolean isXML11NCName(int c) Returns true if the specified character is a valid NCName character as defined by production [5] in Namespaces in XML 1.1 recommendation.- Parameters:
c- The character to check.- Returns:
- true if character is valid namespace classified name character
-
isXML11NameHighSurrogate
public static boolean isXML11NameHighSurrogate(int c) Returns whether the given character is a valid high surrogate for a name character. This includes all high surrogates for characters [0x10000-0xEFFFF]. In other words everything excluding planes 15 and 16.- Parameters:
c- The character to check.- Returns:
- true if character is valid high surrogate
-
isXML11ValidName
Check to see if a string is a valid XML Name.- Parameters:
name- string to check- Returns:
- true if name is a valid XML Name
-
supplemental
public static int supplemental(char h, char l) Returns the supplemental character corresponding to the given surrogates.- Parameters:
h- The high surrogate.l- The low surrogate.- Returns:
- the supplemental character
-
isLowSurrogate
public static boolean isLowSurrogate(int c) Returns whether the given character is a low surrogate.- Parameters:
c- The character to check.- Returns:
- true if character is low surrogate
-