XSD datatype
xs:NCName
An XML name with no colon — the type of every element and attribute name, and of the local half of a QName.
NCName is 'non-colonised name': it must start with a letter or underscore and may then contain letters, digits, hyphens, periods and underscores. No colons, because a colon is what separates a prefix from a local name.
It is the type behind every unqualified name in XML, and the reason an identifier that starts with a digit is rejected by schemas that use it.
- Lexical space
- Letter or underscore, then letters, digits, hyphen, period or underscore. No colon.
- Derives from
xs:Name- 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.
order_privateline-itema.bAda
What does not
1stAn NCName cannot start with a digit.
soap:EnvelopeA colon makes it a QName, not an NCName.
has spaceWhitespace is not allowed in a name.
(the empty string)An NCName must have at least one 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:NCName"/>
</xs:schema>Related
- xs:NameAn XML name, which may contain a colon. Rarely the type you want — NCName usually is.
- xs:QNameA namespace-qualified name — and the one type whose meaning depends on namespace declarations in scope, not just on the characters.
- xs:ID, xs:IDREF and xs:IDREFSDocument-scoped unique identifiers and references to them — with uniqueness enforced across the whole document, not per element.
- 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.