Skip to main content

XML format

XML Schema (XSD)

The dominant XML schema language: namespace-aware, richly typed, and itself written in XML.

An XSD describes what a valid document looks like — its elements, their order, cardinality and datatypes. Because a schema is itself an XML document, schemas can be searched, diffed and version-tracked with the same tooling as the payloads they govern.

Well-formedness and validity are different questions. A document can parse perfectly and still violate its schema, which is why the workspace treats validation as a separate step from ingestion.

Constraints that bite

  • targetNamespace on the schema is what instance documents must declare; omitting it means no-namespace.
  • xsi:schemaLocation in an instance is a hint most validators ignore unless configured.
  • <xs:sequence> is order-sensitive; reordering valid elements can invalidate a document.
  • Imports and includes may resolve over the network — a real supply-chain consideration when validating untrusted schemas.
  • A schema-valid document can still be rejected by a profile layered on top (Peppol, ISO 20022 usage rules).
Root element
<schema>
Media type
application/xml
Extensions
.xsd
Namespaces
  • http://www.w3.org/2001/XMLSchema
XMLDir label
xml

Specification: W3C XML Schema

A minimal valid document

Every example on this site is checked against the same parser the workspace uses, so what you see below is known to be well-formed.

xsd.xml
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="https://example.com/orders"
           elementFormDefault="qualified">
  <xs:element name="Order">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="OrderId" type="xs:integer"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

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.