# No declaration for attribute

Source: https://xmlvalid.com/errors/no-declaration-for-attribute

> The DTD does not declare an attribute the element carries.

Example message: `No declaration for attribute lang of element note`

## Why it happens

- An attribute the DTD does not know, a misspelling, or an attribute meant for another element.

## How to fix it

- Remove or rename the attribute, or add it to the element's `<!ATTLIST …>` in the DTD.

## Example that fails

```xml
<note id="n1" lang="en">
  <to>Ana</to>
  <body>Hi</body>
</note>
```

## Fixed

```xml
<note id="n1">
  <to>Ana</to>
  <body>Hi</body>
</note>
```
