XSD datatype
xs:language
A BCP 47 language tag, checked by shape rather than against the registry.
xs:language accepts tags of the form used by xml:lang — a primary subtag of letters, optionally followed by hyphen-separated subtags. Validation is a pattern check on the structure.
Nothing verifies the tag actually exists. 'zz-ZZ' is a valid xs:language and refers to no language at all.
- Lexical space
- 1–8 letters, then any number of hyphen-separated 1–8 alphanumeric subtags.
- 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.
enen-GBde-CH-1901zz-ZZenglishe
What does not
en_GBSubtags are separated by hyphens, not underscores.
123The primary subtag must be letters, not digits.
en-A trailing hyphen leaves an empty subtag.
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:language"/>
</xs:schema>Related
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.