XML Schema (XSD)
<xs:sequence>
A model group requiring child particles to occur in declared order, subject to each occurrence range.
sequence models records whose children have a stable order. Optional children remain ordered relative to whichever children are present.
Occurrences on the group repeat the entire sequence; the same attributes on a child repeat only that particle.
- Format
- XML Schema (XSD)
- Namespace
- XML Schema Definition (XSD)
- How many
- Zero or one as a primary content model; model groups may nest.
What our validator does
The XML validator checks that both examples are well-formed. It does not enforce this vocabulary's semantic content model, so the broken example is intentionally reported as valid XML.
We do not catch this one
This document is well-formed XML but violates a SOAP or XML Schema vocabulary rule. XML syntax alone cannot detect that defect; use a SOAP-aware processor or an XSD validator when conformance matters.Broken and fixed
Both documents below are well-formed XML — that is the point of this corpus — and both are run through the validator on every test run. The verdicts here are what it returned, not what we expect it to.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:example:catalog">
<xs:complexType name="Product"><xs:attribute name="active" type="xs:boolean" maxOccurs="2"/></xs:complexType>
</xs:schema><?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:example:catalog" elementFormDefault="qualified">
<xs:simpleType name="Sku"><xs:restriction base="xs:string"><xs:minLength value="1"/></xs:restriction></xs:simpleType>
<xs:complexType name="Product"><xs:sequence><xs:element name="sku" type="Sku"/></xs:sequence><xs:attribute name="active" type="xs:boolean"/></xs:complexType>
<xs:element name="product" type="Product"/>
</xs:schema>Where it reaches
- FormatsXML Schema (XSD)The XSD format page places this element in the complete document model.
- NamespacesXML Schema Definition (XSD)The exact namespace URI that gives <xs:sequence> its vocabulary meaning.
- ToolsXSD validatorValidate an instance against a concrete schema after checking the schema document itself.
Related elements
- <xs:choice>A model group that selects one of its child particles each time the group occurs.
- <xs:element>Declares an element's name, type, occurrence range, defaulting, and whether an explicit xsi:nil is allowed.
- <xs:complexType>Defines structured element content: child elements, attributes, mixed text, and derivation from another type.
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.