Guide · 2026-09-30
Markdown exportXML schema errors (cvc-…) in the XRechnung validator
Schema errors mean that the XML structure does not match the UBL or CII XSD. Fix them first: the validator checks the business rules only after the schema check passes.
A cvc- code is an XML schema error: an element is in the wrong order, missing, unknown, in the wrong namespace, or has a value in the wrong format. The KoSIT validator checks the business rules (BR-…) only after the file passes the schema check.
Schema errors and business rules
The KoSIT validator checks an XRechnung in three steps: well-formed XML, XML schema (XSD), then business rules (Schematron).
The XML schema of UBL 2.1 or CII D16B defines which elements exist, in which order they occur, which are required, and which data type a value has. The business rules of EN 16931 and XRechnung (BR-…, BR-DE-…) check the content, for example totals, VAT and required invoice data.
If the schema check fails, the validator does not run the business rules. After you fix the schema errors, new business-rule errors can therefore appear. This is expected.
Where the codes come from
The codes refer to validation rules of the W3C XML Schema specification, for example cvc-complex-type for the content of an element. The XML parser that KoSIT uses reports them together with a line and column in your file.
Frequent messages and their fix
| Code | Meaning | Typical fix |
|---|---|---|
| cvc-complex-type.2.4.a | An element is at a position where the schema does not accept it: wrong order, an element that does not belong there, or a required element missing before it. | Compare the order with the list "One of … is expected". Move the element, or add the missing element before it. |
| cvc-complex-type.2.4.b | An element ends before a required child element. | Add the missing element. The required one is usually the last in the listed elements. |
| cvc-complex-type.2.4.d | An element follows the last child element that the schema allows. | Remove the element or move it to the correct parent element. |
| cvc-datatype-valid.1.2.1 with cvc-complex-type.2.2 or cvc-type.3.1.3 | A value does not match its data type, for example a date or a decimal number. | Dates as YYYY-MM-DD, amounts with a dot as decimal separator, true or false for indicators. |
| cvc-complex-type.4 | A required attribute is missing, for example currencyID on an amount. | Add the attribute, for example currencyID="EUR". |
| cvc-complex-type.3.2.2 | An element has an attribute that the schema does not define for it. | Remove the attribute or correct its spelling (case-sensitive). |
| cvc-complex-type.2.3 | An element that groups other elements contains text. | Put the text into the correct child element. |
| cvc-minLength-valid, cvc-maxLength-valid with cvc-attribute.3 | A value is too short or too long, for example an empty unitCode on a CII measure. | Enter a value with the allowed number of characters. |
| cvc-pattern-valid, cvc-enumeration-valid | A value does not match a pattern or a fixed list. The UBL and CII schemas of XRechnung 3.0.2 define no such constraints for invoice data; business rules (BR-CL-…) check the code lists. | Use the format or value that the message names. |
| Content is not allowed in prolog, must be terminated by the matching end-tag, … | The file is not well-formed XML. No rule was checked. | Correct the XML syntax: text before the XML declaration, unclosed elements, & instead of &. |
Examples
Placeholder values. The order follows the pinned UBL 2.1 and CII D16B schemas.
<cbc:ID>INV-1001</cbc:ID>
<cbc:DueDate>2026-02-14</cbc:DueDate>
<cbc:IssueDate>2026-01-15</cbc:IssueDate><cbc:ID>INV-1001</cbc:ID>
<cbc:IssueDate>2026-01-15</cbc:IssueDate>
<cbc:DueDate>2026-02-14</cbc:DueDate><cbc:IssueDate>15.01.2026</cbc:IssueDate>
<cbc:PayableAmount currencyID="EUR">119,00</cbc:PayableAmount><cbc:IssueDate>2026-01-15</cbc:IssueDate>
<cbc:PayableAmount currencyID="EUR">119.00</cbc:PayableAmount><rsm:ExchangedDocument>
<ram:TypeCode>380</ram:TypeCode>
<ram:ID>INV-1001</ram:ID>
</rsm:ExchangedDocument><rsm:ExchangedDocument>
<ram:ID>INV-1001</ram:ID>
<ram:TypeCode>380</ram:TypeCode>
</rsm:ExchangedDocument>How to fix schema errors
- Fix a not well-formed file first. Until the XML is well-formed, no other check runs.
- Start with the first schema error and use its line and column. One structural error can hide further errors in the same element.
- Read "One of … is expected": these are the elements that the schema accepts at this position, in schema order.
- Correct the export in your ERP or invoicing software instead of editing the XML by hand, so that the next invoice is correct as well.
- Validate again. Expect business-rule errors after the schema errors are fixed.
Common questions
Why does the validator report an element that exists in my file?
Usually the element is in the wrong order. For example, UBL requires cbc:IssueDate before cbc:DueDate. If cbc:DueDate comes first, the validator reports cbc:DueDate with cvc-complex-type.2.4.a and names cbc:IssueDate as expected.
Why do I see new BR errors after I fixed the schema errors?
The validator checks the business rules only after the file passes the schema check. They were not checked before.
Do the line and column refer to my file?
Yes, to the file exactly as you uploaded it. If you reformat or convert the file, the positions change.