errorsyntaxubl-2.1

XML-004:Invalid XML characters

Fix: Remove or encode invalid 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 rejected by Peppol access points and never reaches 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 — the invoice must be corrected and re-sent before it can reach the recipient.

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. This error involves a protected field — Invoice Navigator flags it in your pipeline so your team can correct it at the source.

Yes, XML-004 is a critical error that must be fixed.

Related Errors

Related Content

Last updated: 3 March 2026

Share this guide:

Validate your invoice

Drop your XML here to check for XML-004

Detect XML-004 before submission

This error involves a financial field that can't be auto-modified. We'll flag it with a clear diagnosis so you can fix it at the source.