Class AttributeValues
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static @Opt PreMessage
_checkToken
(@Opt String token, boolean mustBeName) Checks whether the argument fits the rules for Nmtoken, Name, and similars, in XML 1.0.static @Opt PreMessage
checkNameToken
(@Opt String token) Check whether the argument is a legal value for a "Name" token, according to [XML 1.0].static @Opt PreMessage
Check whether the argument is a legal value for an attribute of type "NameTokens".static @Opt PreMessage
checkNCName
(@Opt String token) Check whether the argument is a legal value for a "Name" token and does furthermore not contain a colon ":".static @Opt PreMessage
checkNmToken
(@Opt String token) Check whether the argument is a legal value for "Nmtoken".static @Opt PreMessage
Check whether the argument is a legal value for an attribute of type "NmTokens".static @Opt PreMessage
checkPITarget
(@Opt String token) Check whether the argument is a legal value for a "Name" token and does not start with the three characters "XML" in any combination of upper/lower case.static @Opt PreMessage
checkQName
(@Opt String token) Check whether the argument is a legal value for a "QName".
-
Field Details
-
oneBlank
-
-
Method Details
-
_checkToken
Checks whether the argument fits the rules for Nmtoken, Name, and similars, in XML 1.0. For details seecheckNmToken(java.lang.String)
.- Parameters:
token
- the string to check. Null and the empty string fail the test.mustBeName
- true if the stricter rules for "name" are checked, not only those for NmTokenAttribute.- Returns:
- null on success, otherwise a text which explains the violation.
-
checkNmToken
Check whether the argument is a legal value for "Nmtoken". This check is only an approximation to the XML rules, see below.The flavours of XML names and their relations:
The rules for a correct xml Nmtoken or xml Name are crucial and complicated, see [XML 1.0], grammar rules [5] and [7].
Grammar rule [7] defines Nmtoken as a non-empty string from letters, digits and few punctation characters. XML spec lists about hundred of ranges which can serve as "Letter", either defined as "BaseChar" or "Ideographic". [XML 1.0:rules 84-86].
(XML 1.1 is quite different and lists the code points excluded.)Instead of this XML "Letter" definition we use
Character.isJavaIdentifierStart(char)
as an appproximation, and for "Letter or Digit" we useCharacter.isJavaIdentifierPart(char)
. But both after adding "_" and ":" and excluding the "dollar" sign. And further adding "." and "-" to the latter.
Names are defined by rule [5]. The difference between Nmtokens and Names is, that the very first character of a name must be a "letter" or "_" or ":".
Names are checked bycheckNameToken(String)
.
The Name production must be adhered to by the value of all attributes of type Id, IdRef, IdRefs, Entity, Entities and Notation. (The value for "notation" must be defined somewhere else as a "NOTATION"; this is a further global consistency condition currently not checked by tdom.)The weaker Nmtoken can be used for NmToken, NmTokens and Enumeration values.
Further there is NCName (="No-Colon-Name") [NSinXML 1.0:rule 4], which is a Name not containing a colon "
:
".
NCNames are checked bycheckNCName(String)
.Further there is qname (="qualified Name") [NSinXML 1.0:rule 4], which is one NCName or two NCNames joined by a colon "
:
". QNames are checked bycheckQName(String)
.Further there is PiTarget, which is a Name token which does not start with "(X|x)(M|m)(L|l)" in any combination. PiTargets are checked by
checkPITarget(String)
.Further there are the un-reserved namespace prefixes, which are NCNames and do not start with "(X|x)(M|m)(L|l)" in any combination. [NSinXML: NSC:Reserved Prefixes and Namespace Names].
- Parameters:
token
- the string to check. Null and the empty string fail the test.- Returns:
- null on success, otherwise a text which explains the violation.
-
checkNameToken
Check whether the argument is a legal value for a "Name" token, according to [XML 1.0].
SeecheckNmToken(String)
for details.- Parameters:
token
- the string to check. Null and the empty string fail the test.- Returns:
- null on success, otherwise a text which explains the violation.
-
checkQName
Check whether the argument is a legal value for a "QName". This is defined by [NSinXML 1.0:rule 7].See
checkNmToken(String)
for further details.- Parameters:
token
- the string to check. Null and the empty string fail the test.- Returns:
- null on success, otherwise a text which explains the violation.
-
checkNCName
Check whether the argument is a legal value for a "Name" token and does furthermore not contain a colon ":".
This is defined by [NSinXML 1.0:rule 4], and additionally required for all Attribute Values of type Id/IdRef/IdRefs/Entity/Entities/Notation for a "namespace-valid" document, see [NSinXML 1.0: section 7, last sentence],See
checkNmToken(String)
for further details.- Parameters:
token
- the string to check. Null and the empty string fail the test.- Returns:
- null on success, otherwise a text which explains the violation.
-
checkPITarget
Check whether the argument is a legal value for a "Name" token and does not start with the three characters "XML" in any combination of upper/lower case. These can be used as "PI targets" and are allowed as prefices in namespace declarations. See [XML1.0:section 2.6] and [NSinXML 1.0: section 3, last sentence].See
checkNmToken(String)
for further details of all check methods in this class.- Parameters:
token
- the string to check. Null and empty string fail the test.- Returns:
- null on success, otherwise a text which explains the violation.
-
checkNameTokens
@Opt public static @Opt PreMessage checkNameTokens(@Opt @Opt String tokens, @Opt @Opt List<String> list) Check whether the argument is a legal value for an attribute of type "NameTokens". This must be a list of NameToken values, joined by one single blank = char(0x20). See [XML 1.0} syntax rule [6].- Parameters:
tokens
- the string to check. Null and empty string fail the test.list
- a list where to put the recognized and checked tokens- Throws:
IllegalArgumentException
- when test fails
-
checkNmTokens
@Opt public static @Opt PreMessage checkNmTokens(@Opt @Opt String tokens, @Opt @Opt List<String> list) Check whether the argument is a legal value for an attribute of type "NmTokens". This must be a list of NmToken values, joined by one single blank = char(0x20). See [XML 1.0} syntax rule [8].- Parameters:
tokens
- the string to check. Null and empty string fail the test.list
- a list where to put the recognized and checked tokens- Throws:
IllegalArgumentException
- when test fails
-