# Expecting an element, got nothing

Source: https://xmlvalid.com/errors/expecting-an-element-got-nothing

> A required element is missing at the end of its parent.

Example message: `Expecting an element , got nothing`

## Why it happens

- The last required child is not there.

## How to fix it

- Look at what the schema requires after the element's last child and add it. libxml2 does not always print the expected name, so compare with the schema.

## Example that fails

```xml
<book isbn="1">
  <title>T</title>
</book>
```

## Fixed

```xml
<book isbn="1">
  <title>T</title>
  <year>2020</year>
</book>
```
