XML-004:Invalid XML characters
Document contains invalid XML characters.
Engine Classification
Financial or legal field · Modification blocked by policy
Reason: The document contains characters that are invalid in XML (control characters, incorrectly encoded bytes, etc.). This is typically caused by encoding mismatches or copy-paste from non-standard sources. Fix the source data in your ERP/invoicing system to use valid UTF-8 characters.
What is XML-004?
XML-004 is a fatal validation rule defined in the ubl-2.1 specification. It validates the Character validation element in the UBL invoice XML.
When this rule fires, the invoice is non-compliant and will be rejected by Peppol access points and national validation services. The sending system receives a rejection response and the invoice does not reach the buyer.
Target path: Character validation
Why This Error Matters
Invalid characters break XML parsing.
XML-004 is a hard failure. Invoices that trigger this rule are rejected at the access point and never reach the recipient. In Peppol networks, this means your sending system receives an MLR (Message Level Response) with a rejection status. The invoice must be corrected and re-sent, adding delay to your payment cycle.
Validator Behavior
- ·Causes invoice rejection
- ·Fails UBL schema validation
- ·Error returned: XML-004
- ·Specification: ubl-2.1
How to Fix It
Find invalid chars
Control characters, invalid Unicode
Remove or escape
Use XML entities for special chars
XML Example
Generic example based on the rule's target XPath. Your actual XML structure may differ.
<!-- Triggers validation error --> <Character validation></Character validation>
<!-- Corrected --> <Character validation>VALID_VALUE</Character validation>
Technical Reference
Character validationCommon Causes
- ·Control characters
- ·Null bytes
- ·Invalid Unicode
Seeing this in production? The API handles XML-004 automatically. See the fix response →
Frequently Asked Questions
Document contains invalid XML characters.
Remove or encode invalid characters. Invoice Navigator can help identify and fix this issue.
Yes, XML-004 is a critical error that must be fixed.
Related Errors
Last updated: 19 January 2026
Handle XML-004 Automatically in Your Pipeline
The compliance engine auto-remediates this error with controlled safety policies and evidence pack generation.