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.CharSequence 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.CharSequence qname)
Validate a QName, and return the prefix and local name.
|
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(java.lang.String name)
Validate whether a given string constitutes a valid QName, as defined in XML Namespaces.
|
static boolean |
isValidNCName(java.lang.CharSequence ncName)
Validate whether a given string constitutes a valid NCName, as defined in XML Namespaces.
|
static boolean |
isValidNmtoken(java.lang.CharSequence nmtoken)
Check to see if a string is a valid Nmtoken according to [7]
in the XML 1.0 Recommendation
|
public static boolean isQName(java.lang.String name)
name
- the name to be testedpublic static java.lang.String getPrefix(java.lang.String qname)
qname
- The lexical QName whose prefix is requiredpublic static java.lang.String[] getQNameParts(java.lang.CharSequence qname) throws QNameException
qname
- the lexical QName whose parts are required. Note that leading and trailing
whitespace is not permittedQNameException
- if not a valid QName.public static java.lang.String[] checkQNameParts(java.lang.CharSequence 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(java.lang.CharSequence ncName)
ncName
- the name to be tested. Any whitespace trimming must have already been applied.public static boolean isValidNmtoken(java.lang.CharSequence nmtoken)
nmtoken
- 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-2018 Saxonica Limited. All rights reserved.