# cvc-complex-type.2.4.d: no child is expected here

The parent has already consumed all the children its content model permits, yet another element arrives. Xerces reports that no child is expected at this point. This is a structural overflow rather than a failure to parse the tag.

## Literal meaning

The schema permits exactly one line inside batch. The second line exceeds maxOccurs="1", so removing the accidental duplicate yields a complete valid batch. The corrected toy document illustrates duplicate removal; real application data must be reconciled before any record is discarded.

## Three common causes

1. A child exceeds its maximum count. Remember that maxOccurs defaults to one when the attribute is absent.
2. Two mutually exclusive choice branches were emitted together. Once the permitted branch is complete, the next branch may be an additional illegal child.
3. A field was written at the wrong nesting level. A tag intended for the next record can arrive after the current parent’s allowed content has finished.

## Repair

Inspect the parent’s particle and the occurrence limits of both the child and enclosing groups. Count children in document order, then identify the transition after which the validator expects the parent to end. Correct the export loop, duplicate join or container boundary that produced the surplus. Rerun with a real multi-record example to check that the repair preserves every intended record.

## Namespace checks

Changing a namespace cannot make a truly exhausted content model accept more children. A namespace mismatch may influence which earlier branch was selected, so inspect earlier diagnostics first. If a repeated child has the same expanded name as its accepted predecessor, occurrence counting is the stronger lead.

The a and d suffixes answer different questions. The a case can often name another expected child; the d case says the parent should stop accepting children. Increasing maxOccurs without agreement changes the contract and can conceal accidental duplication in upstream data.

## Extra child / cvc-complex-type.2.4.d — Broken

```xml
<batch>
  <line>A</line>
  <line>B</line>
</batch>
```

```xml
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="batch">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="line" type="xs:string" maxOccurs="1"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
```

[Open broken pair](https://xsdhub.com/?example=parser-extra-child&variant=bad#workbench)

## Extra child / cvc-complex-type.2.4.d — Corrected

```xml
<batch>
  <line>A</line>
</batch>
```

```xml
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="batch">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="line" type="xs:string" maxOccurs="1"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
```

[Open corrected pair](https://xsdhub.com/?example=parser-extra-child&variant=good#workbench)

### Apache Xerces-J 2.12.2

```text
cvc-complex-type.2.4.d: Invalid content was found starting with element 'line'. No child element is expected at this point.
```

Corrected: PASS.

### .NET 8.0.33 · System.Xml.Schema

```text
The element 'batch' has invalid child element 'line'.
```

Corrected: PASS.

### XSDHub libxml2/WASM 0.7.2

```text
Element 'line': This element is not expected.
```

Corrected: PASS.

### XSDHub xmlschema 4.3.1 · XSD 1.0

```text
Unexpected child with tag 'line' at position 2.
```

Corrected: PASS.

Saxon EE was not available; no measured Saxon wording is claimed.

[All parser codes](https://xsdhub.com/learn#parser-error-codes)
[Download engine evidence](https://xsdhub.com/parser-error-examples/engine-evidence.json)
