# The attribute is required but missing

Source: https://xmlvalid.com/errors/attribute-is-required-but-missing

> An attribute declared with use="required" is not on the element.

Example message: `Element 'order': The attribute 'currency' is required but missing.`

## Why it happens

- The attribute was left out, or misspelt.
- A prefixed attribute where the schema expects an unprefixed one (or the reverse): attributes are in no namespace unless they have a prefix.

## How to fix it

- Add the attribute with a valid value.

## Example that fails

```xml
<order>
  <id>A-1</id>
  <qty>1</qty>
</order>
```

## Fixed

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