Skip to content
Klarfile

KF-XML-DOCTYPE: The XML declares a DTD, and we refuse it

This code shows up when an electronic invoice is validated. Here is what it means, why it fires, and what to change in the file.

Why this code appears

The attached file contains a <!DOCTYPE> declaration. We read no DTD coming from a third party: entities that call one another can blow up the browser's memory, and an external entity asks the reader to go and fetch a file elsewhere. No legitimate Factur-X invoice carries one.

How to fix it

Produce the XML without a document type declaration. If your tool adds one, it is a serialisation setting, not a requirement of the format.

What it looks like in the file

These two snippets are replayed against our own checker on a complete invoice, every time the site is built. The first one raises this code, the second one does not.

What raises the code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rsm:CrossIndustryInvoice SYSTEM "facture.dtd">

What to write instead:

<?xml version="1.0" encoding="UTF-8"?>

Where it happens

This check is ours, not a code from the standard: we do not cover enough of EN 16931 to borrow its numbers, and a misattributed official code would send you to fix the wrong field. It concerns XML.

Check my invoice All rejection codes