SCHEMA-002
Wrong XML Namespace or Root Element
What This Error Means
The root element or its namespace declaration does not match the expected UBL 2.1 Invoice or CreditNote namespace. XRechnung uses UBL 2.1: the namespace for invoices is 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2'. ZUGFeRD/Factur-X uses a different namespace (Cross Industry Invoice).
Why this happens
SCHEMA-002 means the document is well-formed XML, but its root element or namespace is not what the validator expects. XRechnung in UBL must use <Invoice> (or <CreditNote>) with the UBL 2.1 namespace; ZUGFeRD/Factur-X uses a completely different Cross Industry Invoice (CII) root and namespace. The error commonly occurs when a CII file is sent to a UBL endpoint (or vice versa), when the default namespace is missing or misspelled, when the cac/cbc prefixes are bound to wrong URIs, or when a credit note is wrapped in an <Invoice> element instead of <CreditNote>.
How to Fix It
Ensure the root element is <Invoice> or <CreditNote> and carries the correct UBL 2.1 namespace declaration. Do not mix UBL and CII namespaces in the same document.
Step-by-step
1) Confirm which syntax the receiver expects: UBL or CII. 2) For UBL invoices, the root must be <Invoice> with the default namespace urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 and the standard cac/cbc namespace bindings. 3) For credit notes, use <CreditNote> with its own UBL namespace, not <Invoice>. 4) Do not mix UBL and CII namespaces in one document. 5) If you intended to send ZUGFeRD, send the PDF/A-3 with the embedded CII, not the bare UBL XML. 6) Re-validate.
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
<!-- invoice content -->
</Invoice>Fix Automatically
Upload your invoice to our Smart Repair engine. It will detect and fix SCHEMA-002 errors automatically with a GoBD audit trail.
Open Smart RepairFrequently asked questions
Which namespace does XRechnung use?
For UBL invoices, urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 (and the CreditNote-2 namespace for credit notes). For CII, the Cross Industry Invoice namespace is used instead.
Can I mix UBL and CII?
No. A document is either UBL or CII end to end. Mixing the namespaces produces SCHEMA-002. Choose one syntax and use it consistently.
Related Errors
Other commonly encountered validation errors