Skip to main content

XML error · prolog

Unsupported XML version

The declaration names an XML version that does not exist. There are only two — 1.0 and 1.1 — and in practice you want 1.0 unless you know otherwise.

Unsupported version '2.5' (line 1)

What it means

XML has had exactly two versions in its life. 1.0 is what essentially everything reads and writes; 1.1 exists mainly to permit control characters and additional line-ending forms, and support for it is thin enough that choosing it is usually a mistake.

There is no 2.0, and there never has been. A version number above 1.1 is always a typo, a placeholder, or a confusion with the version of something else — a schema, a feed format, an API.

What usually causes it

  • Confusing the XML version with the document format's version: RSS 2.0, SOAP 1.2, UBL 2.1.
  • A template variable for the payload version leaking into the declaration.
  • A copy-paste that grabbed a version number from the wrong line.

How to fix it

  • Use version="1.0". It is the right answer for nearly every document.
  • Reach for 1.1 only if you specifically need its relaxed character rules, and check every consumer supports it first.
  • Keep the format's own version where it belongs — the root element's attribute, not the declaration.

The same error elsewhere

Different parsers, same defect. If you arrived with one of these messages, you are in the right place.

  • Xerces (Java)

    XML version "2.5" is not supported, only XML 1.0 is supported.
  • expat (Python)

    XML declaration not well-formed: line 1, column 20
  • .NET System.Xml

    Version number must start with '1.'

Before and after

Both snippets are re-checked by the test suite against the real parser: the first is confirmed to produce the exact error above, the second to parse cleanly.

Fails
<?xml version="2.5"?>
<root/>
Parses
<?xml version="1.0"?>
<root/>

Where this bites most

Get started

Bring order to the XML your team can't afford to ignore.

Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.