EN 16931 Invoice (UBL)
A UBL invoice checked against the schema and the business rules of the European e-invoicing standard EN 16931: mandatory fields, code lists and totals.
About
EN 16931 is the European standard for electronic invoices in public procurement, and the base that Peppol BIS Billing, XRechnung and most national formats build on. Its rules are published as Schematron by the European Commission together with CEN/TC 434.
The document is checked against the UBL 2.1 Invoice schema first. When it passes, the EN 16931 rules run: over 200 business rules and the code list checks, such as BR-CO-15 (total with VAT = total without VAT + VAT) and BR-CL-25 (electronic address scheme from the EAS code list).
Good to know
- Rules run only when the document matches the schema, as in the KoSIT validator. Documents over 50 MB are checked against the schema only.
- The example is from the EN 16931 validation artefacts by the European Commission (EUPL 1.2).
Files
14 files · 2.7 MB-
maindoc/UBL-Invoice-2.1.xsd main
-
common/UBL-CommonAggregateComponents-2.1.xsd
-
common/UBL-CommonBasicComponents-2.1.xsd
-
common/UBL-CommonExtensionComponents-2.1.xsd
-
common/UBL-QualifiedDataTypes-2.1.xsd
-
common/UBL-UnqualifiedDataTypes-2.1.xsd
-
common/UBL-ExtensionContentDataType-2.1.xsd
-
common/CCTS_CCT_SchemaModule-2.1.xsd
-
common/UBL-CommonSignatureComponents-2.1.xsd
-
common/UBL-SignatureAggregateComponents-2.1.xsd
-
common/UBL-SignatureBasicComponents-2.1.xsd
-
common/UBL-xmldsig-core-schema-2.1.xsd
-
common/UBL-XAdESv132-2.1.xsd
-
common/UBL-XAdESv141-2.1.xsd
The validator loads all of these with their folder structure, so includes and imports resolve as published.
Business rules
Schematron · run in this orderThe rules run after the schema check, only when the document matches the schema, and in your browser like the schema check (with SaxonJS by Saxonica). Each finding names its rule, such as BR-CO-15, and the line it points at; each rule has a page with what it checks.
Example document
ubl-tc434-example1.xml · 21 KB · passes the schema and the rules
In CI and from code
The same schema by its name, en16931-ubl-invoice, through the API.
npx @xmlvalid/cli validate "**/*.xml" --schema en16931-ubl-invoice
- uses: xmlvalid/validate-action@v1
with:
files: "**/*.xml"
schema: en16931-ubl-invoice
api-key: ${{ secrets.XMLVALID_API_KEY }}
curl https://xmlvalid.com/api/v1/validations \
-H "Authorization: Bearer $XMLVALID_API_KEY" \
-F document={{ $schema->example ?? 'document.xml' }} -F schema=en16931-ubl-invoice
Free accounts get 100 API validations a month. On Pro, a URL monitor can check a published document against this schema every hour and email you when it breaks. More CI setups