What is the usefulness of NMTOKEN and NMTOKENS types?
NMTOKEN
and NMTOKENS
exist in XML Schema only for compatibility with DTDs, the predecessor of XML Schema, which had those as attributes types. DTD has few other types so those don't stand out as redundant there.
So use NMTOKEN
and NMTOKENS
when you're converting a DTD to an XML Schema.
Addendum: Those and other all caps types fall into the same category. They are marked in the XML Schema Rec with the text, "For compatibility NMTOKEN should be used only on attributes."
If they exactly fit your needs, it might be easiest to use just them, but the XML Schema way is to derive from xs:string
or xs:token
and constrain as needed with a pattern
facet. Or, more commonly in my experience, use xs:string
or xs:token
as-is and call it close enough.