W3C-XML-SCHEMA
W3C XML Schema (XSD). The standard schema language for describing the structure and constraints of an XML document — technical foundation of modern EDI XML syntaxes.
Definition
W3C XML Schema, abbreviated XSD (XML Schema Definition), is a family of World Wide Web Consortium recommendations that specify an XML schema language. An XSD lets you:
- Describe the structure of an XML document: root element, sub-elements, attributes, cardinalities (minOccurs, maxOccurs), order (sequence, choice, all).
- Constrain value types: primitive types (xs:string, xs:decimal, xs:date, xs:boolean), types derived by restriction (regex pattern, enumeration, minLength, maxLength, minInclusive, maxInclusive), complex types by extension.
- Manage namespaces: each schema carries a targetNamespace and can import or include other schemas.
- Enable validation: XML parsers (Xerces, Saxon, libxml2, .NET XmlReader) can validate a document against its XSD in real time.
XSD lives in two W3C-published versions: 1.0 (2001, more widely deployed) and 1.1 (2012, which adds assertions, conditional alternatives, open types). The entire modern EDI XML toolchain — UBL, cXML, GS1 XML, UN/CEFACT CII, EN 16931 syntax bindings, OASIS ebXML, ISO 20022 — uses XSD 1.0 as the technical contract.
Origin
XSD was published as a W3C Recommendation on 2 May 2001 (Part 1 Structures, Part 2 Datatypes), after five years of work in the W3C XML Schema Working Group. It succeeds DTD (Document Type Definition, inherited from SGML), which had no data typing and no namespace concept. The W3C published a 1.1 revision in April 2012, little deployed in the EDI world. XSD 1.0 thus remains the de facto target.
Example in context
UBL 2.1 XSD fragment constraining an invoice identifier:
IdentifierType is defined in the UBL Unqualified Data Types
sub-schema, derived from xs:normalizedString. Any
XSD-conformant parser will refuse an empty or missing Invoice/ID.
Related terms
- Schematron — the other XML schema language, rule-based.
- OASIS — producer of UBL in XSD.
- ISO 20022 — another XSD family.
- XAdES — XML signature, complementary to XSD.