# XV-ES-01

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

> A Spanish NIF has no valid check character, so the AEAT won't find it in its census ('…' in …/…).

- Level: error
- Rule sets: VERI*FACTU checks of the AEAT Validaciones 1.2.2 (8 April 2026)
- Context: `/*:RegFactuSistemaFacturacion//*:NIF | /*:RegFactuSistemaFacturacion//*:IDEmisorFactura | /*:RegFactuSistemaFacturacion//*:IDEmisorFacturaAnulada`
- Test: `es:nif(.)`

> A Spanish NIF has no valid check character, so the AEAT won't find it in its census ('…' in BuyerParty/TaxIdentificationNumber).

- Level: error
- Rule sets: Facturae validation rules of the Spanish public sector Orden HAP/1650/2015, Facturae 3.2.x description of 6 June 2017
- Context: `/*:Facturae/*:Parties/*:BuyerParty`
- Test: `empty($nif) or es:nif($nif)`

## Why it fails

- A typo in the NIF, so its check letter or digit no longer matches: the last character of a DNI (12345678Z) or NIE (X1234567L), the last of a company's NIF (B12345674).
- The NIF written with the country prefix ES, spaces or dashes.

## How to fix it

- Give the NIF as the AEAT registered it: nine characters, capitals, no prefix. This is our check: the AEAT rejects such a NIF as not in its census (codes 1109, 4107 and similar).

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