XSD datatype
xs:NMTOKENS
A whitespace-separated list of NMTOKEN values, with list whitespace collapsed before validation.
xs:NMTOKENS is the built-in list type whose items are xs:NMTOKEN. Runs of spaces, tabs and line breaks are collapsed, then each remaining token is validated independently.
The XSD 1.0 datatype is derived with minLength 1, but the libxml2 validator used here accepts an empty element for the built-in type. Add an explicit minLength facet when an empty list must be rejected consistently.
- Lexical space
- One or more NMTOKEN values separated by XML whitespace.
- Derives from
xs:anySimpleType- Category
- String types
- Facets
- length, minLength, maxLength, enumeration, whiteSpace
What validates
Every literal below is put through the schema validator on each test run, against the schema at the foot of this page.
oneone twoalpha-1 beta.2one two(the empty string)
What does not
one a/bThe second item contains a slash, which is not a name character.
one,twoA comma is not a list separator or a name character.
The schema used
This is the exact schema the literals above are validated against. Paste it into the validator with one of them to see the result yourself.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="v" type="xs:NMTOKENS"/>
</xs:schema>Related
- xs:NMTOKENOne XML name token: name characters without the rule that the first character must be a letter or underscore.
- xs:tokenA string trimmed of leading and trailing whitespace, with internal runs collapsed to one space. The right type for most identifiers.
- minLength, maxLength and lengthBounds on size — measured in characters for strings, list items for lists, and bytes for binary.
Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.