XSD validation error
Missing child element(s)
The element ended before its content model was satisfied. The schema names what it was still waiting for, which makes this the most actionable schema error.
Element 'order': Missing child element(s). Expected is ( line ). (line 2)What it means
Every element in an xs:sequence without minOccurs="0" is mandatory. When the closing tag arrives and one is still outstanding, the validator reports the parent — the element that ended too early — and names what it expected.
The reported line is the parent's opening tag, not the point where the content ran out, so on a long element the position can be some distance from where you would start looking.
What usually causes it
- An empty collection serialized as no elements at all, where the schema requires at least one.
- A conditional branch that omits a field when its value is null.
- A filter applied before serialization that removed every member of a required repeating group.
- A mapping that writes the element under the wrong parent, so it is missing here and unexpected there.
How to fix it
- Read the ( … ) list in the message — it is the exact set of elements the validator was waiting for.
- If the element is legitimately optional, set minOccurs="0" in the schema rather than shipping documents without it.
- Look for the same element reported as unexpected elsewhere in the document; that means it is misplaced, not absent.
The same error elsewhere
libxml2 words these plainly. Xerces numbers them, and those cvc- codes are what most people end up searching for.
Xerces (Java)
cvc-complex-type.2.4.b: The content of element 'order' is not complete. One of '{line}' is expected..NET System.Xml
The element 'order' has incomplete content.
Before and after
Both documents below are well-formed XML — that is the point. The test suite re-checks them against the real validator on every build: the first is confirmed to produce the exact message above, the second to validate cleanly.
<?xml version="1.0" encoding="UTF-8"?>
<order id="A-1">
<customer>Ada</customer>
<issued>2026-01-31</issued>
<state>open</state>
</order>
<?xml version="1.0" encoding="UTF-8"?>
<order id="A-1">
<customer>Ada</customer>
<issued>2026-01-31</issued>
<state>open</state>
<line>
<code>AB-1234</code>
<qty>2</qty>
</line>
</order>
The schema both are checked against
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="status">
<xs:restriction base="xs:string">
<xs:enumeration value="open"/>
<xs:enumeration value="closed"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="sku">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z]{2}-\d{4}"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="order">
<xs:complexType>
<xs:sequence>
<xs:element name="customer" type="xs:string"/>
<xs:element name="issued" type="xs:date"/>
<xs:element name="state" type="status"/>
<xs:element name="line" minOccurs="1" maxOccurs="2">
<xs:complexType>
<xs:sequence>
<xs:element name="code" type="sku"/>
<xs:element name="qty" type="xs:positiveInteger"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
Where this bites most
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.