XV-ES-01
The rule sets below word this rule differently; each wording is shown with its rule set.
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).
What the rule checks
As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element.
A Spanish NIF has no valid check character, so the AEAT won't find it in its census ('…' in …/…).
/*:RegFactuSistemaFacturacion//*:NIF | /*:RegFactuSistemaFacturacion//*:IDEmisorFactura | /*:RegFactuSistemaFacturacion//*:IDEmisorFacturaAnulada
es:nif(.)
Checked with VERI*FACTU invoice records
A Spanish NIF has no valid check character, so the AEAT won't find it in its census ('…' in BuyerParty/TaxIdentificationNumber).
/*:Facturae/*:Parties/*:BuyerParty
empty($nif) or es:nif($nif)
Checked with Facturae 3.2.2