# No matching global declaration available for the validation root

Source: https://xmlvalid.com/errors/no-matching-global-declaration

> The schema has no top-level declaration for the document's root element.

Example message: `Element 'invoice': No matching global declaration available for the validation root.`

## Why it happens

- The wrong schema for this document.
- A namespace mismatch, the most common cause. The schema has a `targetNamespace` and the document's root is not in it (no `xmlns="…"`, or a different URI), or the document has a namespace the schema doesn't. The message then shows the root as `{namespace}name`.
- The root element is declared only locally, inside another element, not as a global `xs:element`.

## How to fix it

- Compare the root element's name and namespace with the schema's global `xs:element` declarations and its `targetNamespace`. The namespace URI has to match character for character.

## Example that fails

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

## Fixed

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