Skip to main content
XMLDir

Search 261 pages — tools, formats, elements, namespaces, XPath, datatypes, glossary, parse errors, schema errors, use cases, blog and product.

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
  • _private
  • line-item
  • a.b
  • Ada

What does not

  • 1st

    An NCName cannot start with a digit.

  • soap:Envelope

    A colon makes it a QName, not an NCName.

  • has space

    Whitespace is not allowed in a name.

  • (the empty string)

    An NCName must have at least one character.

What catches people out

  • It cannot start with a digit, which rules out most numeric identifiers.
  • Hyphens and periods are legal but colons are not — that is the whole distinction from xs:Name.
  • xs:ID derives from NCName, so an ID attribute inherits every one of these restrictions.

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.