public abstract class NameChecker
extends java.lang.Object
In releases prior to 9.6, there were two name checkers, one for XML 1.0 and one for XML 1.1. However, XML 1.0 fifth edition uses the same rules for XML names as XML 1.1, so they were actually checking the same rules for names (although they were different when checking for valid characters). From 9.6, the name checker no longer performs checks for valid XML characters, so only one name checker is needed, and the methods have become static.
| Constructor and Description |
|---|
NameChecker() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String[] |
checkQNameParts(java.lang.String qname)
Validate a QName, and return the prefix and local name.
|
static java.lang.String |
getPrefix(java.lang.String qname)
Extract the prefix from a QName.
|
static java.lang.String[] |
getQNameParts(java.lang.String qname) |
static boolean |
isNCNameChar(int ch)
Test whether a character can appear in an NCName
|
static boolean |
isNCNameStartChar(int ch)
Test whether a character can appear at the start of an NCName
|
static boolean |
isQName(IntIterator codePoints)
Validate whether a given string constitutes a valid QName, as defined in XML Namespaces.
|
static boolean |
isValidNCName(IntIterator codePoints)
Validate whether a given string constitutes a valid NCName, as defined in XML Namespaces.
|
static boolean |
isValidNCName(java.lang.String str) |
static boolean |
isValidNmtoken(UnicodeString in)
Check to see if a string is a valid Nmtoken according to [7]
in the XML 1.0 Recommendation
|
public static boolean isQName(IntIterator codePoints)
codePoints - the name to be tested, supplied as a codepoint iteratorpublic static java.lang.String getPrefix(java.lang.String qname)
qname - The lexical QName whose prefix is requiredpublic static java.lang.String[] getQNameParts(java.lang.String qname)
throws QNameException
QNameExceptionpublic static java.lang.String[] checkQNameParts(java.lang.String qname)
throws XPathException
Used from compiled code
qname - the lexical QName whose parts are required. Note that leading and trailing
whitespace is not permittedXPathException - if not a valid QName.public static boolean isValidNCName(IntIterator codePoints)
codePoints - the name to be tested, as a codepoint iterator.
Any whitespace trimming must have already been applied.public static boolean isValidNCName(java.lang.String str)
public static boolean isValidNmtoken(UnicodeString in)
in - the string to be tested.
Any whitespace trimming must have already been applied.public static boolean isNCNameChar(int ch)
ch - the character to be testedpublic static boolean isNCNameStartChar(int ch)
ch - the character to be testedCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.