einvoice / EN 16931 / XRechnung rule reference

BR-DEX-04

What this rule means and how to fix it

Any scheme identifier on a Party identifier (cac:Party Identification/cbc:ID) must be an ISO 6523 ICD (extension) code — or 'SEPA' when the identifier belongs to the Seller or the Payee.

Jede Schema-Kennung einer Beteiligtenkennung (cac:PartyIdentification/cbc:ID) muss ein ISO-6523-ICD-Code (Extension) sein – oder 'SEPA', wenn die Kennung zum Verkäufer oder zum Zahlungsempfänger gehört.

Deutsche Fassung: Übersetzung der gleichen BT/BG-Semantik (translation — not the official assert).

Requires
any scheme identifier on a Party identifier (cac:Party Identification/cbc:ID) must be an ISO 6523 ICD (extension) code — or 'SEPA' when the identifier belongs to the Seller or the Payee.
Business terms
— (no single business term)
Syntax
Binds the UBL-2.1 Invoice / CreditNote syntax and the UN/CEFACT-CII syntax
Location (UBL-2.1 path)
cac:PartyIdentification/cbc:ID[@schemeID and $isExtension]
Fix
Correct `cac:PartyIdentification/cbc:ID[@schemeID and $isExtension]` so that any scheme identifier on a Party identifier (cac:Party Identification/cbc:ID) must be an ISO 6523 ICD (extension) code — or 'SEPA' when the identifier belongs to the Seller or the Payee.
Fix (Deutsch)
Korrigieren Sie `cac:PartyIdentification/cbc:ID[@schemeID and $isExtension]`, sodass gilt: Jede Schema-Kennung einer Beteiligtenkennung (cac:PartyIdentification/cbc:ID) muss ein ISO-6523-ICD-Code (Extension) sein – oder 'SEPA', wenn die Kennung zum Verkäufer oder zum Zahlungsempfänger gehört.
Severity
fatal
Provenance source
xrechnung-ubl
Provenance assert

Any scheme identifier in MUST be coded using one of the ISO 6523 ICD list.

The Location above is a UBL-2.1 path, and no UN/CEFACT-CII path for this rule is published here; Fix and Fix (Deutsch), verbatim from remediation_catalog.json and not reworded here; the UN/CEFACT-CII binding of this rule is differentially proven against the official KoSIT XRechnung 2.5.0 (XRechnung 3.0.2) Schematron.

Where to check the fix: paste the corrected invoice into the browser validator at /einvoice/validate/ — it runs this same engine locally in your browser, with no upload, and stops reporting BR-DEX-04 once the edit lands.

Korrektur prüfen: Laden Sie die geänderte Rechnung in den Browser-Validator unter /einvoice/validate/ — er führt dieselbe Engine lokal im Browser aus, ohne Upload, und meldet BR-DEX-04 nicht mehr, sobald die Korrektur greift.

The same invoice, failing and fixed

No vendored test suite ships a labelled example for this rule, so this pair was found rather than written. The engine was run over the vendored instance corpus/xrechnung-testsuite/src/test/business-cases/extension/04.02a-INVOICE_ubl.xml under --profile xrechnung, then re-run over the same file with one mechanical edit applied to one element, over and over, until the edit below changed the verdict: the schemeID attribute of ID was changed from SEPA to ZZZ, a token that appears in no code list. The page publishes it because the engine reported BR-DEX-04 for the edited document and did not report it for the untouched one.

UBL Invoice (XRechnung extension) — fails

The vendored file around the change, verbatim:

<cac:PartyIdentification>
  <cbc:ID schemeID="ZZZ">ID123456</cbc:ID>
</cac:PartyIdentification>

UBL Invoice (XRechnung extension) — passes

The same lines as 04.02a-INVOICE_ubl.xml actually ships them — this block is the fix for the block above:

<cac:PartyIdentification>
  <cbc:ID schemeID="SEPA">ID123456</cbc:ID>
</cac:PartyIdentification>

What the engine reports for the edited invoice

{
  "element": "cac:PartyIdentification/cbc:ID/@schemeID",
  "field": "cac:PartyIdentification/cbc:ID/@schemeID",
  "fix_hint": "Correct `cac:PartyIdentification/cbc:ID[@schemeID and $isExtension]` so that any scheme identifier on a Party identifier (cac:Party Identification/cbc:ID) must be an ISO 6523 ICD (extension) code — or 'SEPA' when the identifier belongs to the Seller or the Payee.",
  "location": "cac:PartyIdentification/cbc:ID[@schemeID and $isExtension]",
  "message": "Any scheme identifier on a Party identification (BT-29/BT-46/BT-60) must be coded with an ISO 6523 ICD code (or 'SEPA' for the Seller/Payee creditor identifier).",
  "rule": "BR-DEX-04",
  "severity": "fatal",
  "terms": [],
  "title": "Any scheme identifier on a Party identifier (cac:Party Identification/cbc:ID) must be an ISO 6523 ICD (extension) code — or 'SEPA' when the identifier belongs to the Seller or the Payee."
}

Rule ids the engine reports for 04.02a-INVOICE_ubl.xml untouched: none. After the edit, BR-CL-10 BR-DE-30 BR-DEX-04 are reported that were not before — one mechanical edit can break more than one rule at a time, and BR-CL-10 BR-DE-30 are the neighbours this one takes with it.

Two honest limits. This is an edit that provokes the rule, not the only one, and it is not a claim about how real exporters break it. And it is the reverse of the fix a reader needs: the passing block is the vendored file's own content, which is what a conformant invoice looks like here.

Reproduce it yourself: take corpus/xrechnung-testsuite/src/test/business-cases/extension/04.02a-INVOICE_ubl.xml from this repository, apply the one edit named above, and run einvoice validate 04.02a-INVOICE_ubl.xml --profile xrechnung --format json, or paste the file into the browser validator, which runs this same engine locally with no upload.

Everything here is free and open source — pick up whatever helps, at your own pace: