# Did not expect element there

Source: https://xmlvalid.com/errors/did-not-expect-element

> An element the RelaxNG pattern does not allow at this point.

Example message: `Did not expect element extra there`

## Why it happens

- An element that is not in the schema, or is in a different namespace.
- Elements out of order: in a RelaxNG `group` (the default) the order matters; only `interleave` lets them come in any order.

## How to fix it

- Remove the element, move it to where the schema allows it, or put it in the namespace the schema uses.

## Example that fails

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

## Fixed

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