errorubl-2.1

XML-004:Invalid XML characters

Document contains invalid XML characters.

Severity
Fatal
Rule set
ubl-2.1
Country
All EU
Fix type
BLOCKED

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

This error requires manual correction — financial fields are protected by policy.

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

1.

Find invalid chars

Control characters, invalid Unicode

2.

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.

Before
<!-- Triggers validation error -->
<Character validation></Character validation>
After
<!-- Corrected -->
<Character validation>VALID_VALUE</Character validation>

Technical Reference

XPathCharacter validation
Specubl-2.1

Common 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

Share this guide:

Handle XML-004 Automatically in Your Pipeline

The compliance engine auto-remediates this error with controlled safety policies and evidence pack generation.