# Opening and ending tag mismatch

Source: https://xmlvalid.com/errors/opening-and-ending-tag-mismatch

> An end tag does not match the start tag it should close.

Example message: `Opening and ending tag mismatch: to line 2 and too`

## Why it happens

- A typo in the end tag (`</too>` for `<to>`), or a different letter case: XML names are case-sensitive, so `<Item>` is not closed by `</item>`.
- Elements closed in the wrong order: `<b><i>…</b></i>`.
- An HTML habit: an element left open, such as `<br>` instead of `<br/>`, so the next end tag closes the wrong element.

## How to fix it

- The message names both tags: the first is the start tag still open (with its line), the second the end tag that was found. Go to the start tag's line and make the end tag match it exactly. If the start tag was never meant to stay open, close it there.

## Example that fails

```xml
<note>
  <to>Ana</too>
</note>
```

## Fixed

```xml
<note>
  <to>Ana</to>
</note>
```
