# The element has incomplete content

Source: https://xmlvalid.com/errors/element-has-incomplete-content

> An element ended before all the children the schema requires appeared.

The message, as .NET reports it: `The element 'order' has incomplete content. List of possible elements expected: 'qty'.`

## Why it happens

- A required child element is missing: its `minOccurs` is 1, the default.
- The child is there but in another namespace, so it does not count.
- Serialized output: `XmlSerializer` leaves out a property that is `null`.

## How to fix it

- Add the elements in the list at the end of the element the message names, or make them optional in the schema if they really are.
- .NET throws an `XmlSchemaValidationException` at the first schema error unless `XmlReaderSettings.ValidationEventHandler` is set, which then receives every one with its line and position. A well-formedness error is an `XmlException` and ends reading whatever the settings.

## The same problem in xmlvalid

libxml2, which xmlvalid validates with, reports it as [Missing child element(s)](https://xmlvalid.com/errors/missing-child-elements): `Element 'order': Missing child element(s). Expected is ( qty ).`

## Example that fails

```xml
<order currency="EUR">
  <id>A-1</id>
</order>
```

## Fixed

```xml
<order currency="EUR">
  <id>A-1</id>
  <qty>1</qty>
</order>
```
