XSD datatype
xs:NMTOKEN
One XML name token: name characters without the rule that the first character must be a letter or underscore.
xs:NMTOKEN accepts the characters XML permits inside a name, including digits, hyphens, periods and colons, but it does not require a name-like first character. That is why '42' is a valid NMTOKEN and not a valid Name.
It is a lexical token rather than a namespace-aware QName. A colon carries no prefix binding requirement here.
- Lexical space
- One or more XML NameChar characters, with no whitespace.
- Derives from
xs:token- Category
- String types
- Facets
- length, minLength, maxLength, pattern, 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.
section-142ns:itema.b_private
What does not
two wordsWhitespace separates tokens and is not part of one NMTOKEN.
(the empty string)At least one name character is required.
a/bA slash is not an XML 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:NMTOKEN"/>
</xs:schema>Related
- xs:NMTOKENSA whitespace-separated list of NMTOKEN values, with list whitespace collapsed before validation.
- xs:NameAn XML name, which may contain a colon. Rarely the type you want — NCName usually is.
- xs:NCNameAn XML name with no colon — the type of every element and attribute name, and of the local half of a QName.
- xs:tokenA string trimmed of leading and trailing whitespace, with internal runs collapsed to one space. The right type for most identifiers.
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.