# XV-ES-02

Source: https://xmlvalid.com/rules/XV-ES-02

> An EU VAT number given with IDType 02 (NIF-IVA) doesn't have the structure of any member state's VAT number: a country prefix in capitals and its number of characters, as the AEAT's validations document lists them ('…').

- Level: error
- Rule sets: VERI*FACTU checks of the AEAT Validaciones 1.2.2 (8 April 2026)
- Test: `$otype != '02' or es:vat($oid)`

## Why it fails

- The VAT number without its country prefix, with spaces, or in lower case.
- A non-EU tax number given with IDType 02, which is for EU VAT numbers (NIF-IVA) only.

## How to fix it

- Write the number as VIES shows it, prefix included (FR12345678901, EL123456789 for Greece, XI for Northern Ireland); for other countries use IDType 04, 05 or 06.

Validate a document against these rules: https://xmlvalid.com/validate
