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.
<?xml version="2.5"?>
<root/><?xml version="1.0"?>
<root/>Where this bites most
Other XML errors
- Opening and ending tag mismatch
- Premature end of data in tag
- Extra content at the end of the document
- Unescaped ampersand (EntityRef: expecting ';')
- Entity is not defined
- Start tag expected
- XML declaration allowed only at the start of the document
- Unquoted attribute value (AttValue expected)
- Attribute redefined
- Attributes construct error (unterminated quote)
- Invalid element name
- Document is empty
- Unsupported encoding
- Sequence ']]>' not allowed in content
- Comment not terminated
- Detected an entity reference loop
- PCDATA invalid Char value (control character)
- Unescaped '<' in an attribute value
- Invalid numeric character reference
- Blank needed here
- Malformed declaration expecting version
- Processing instruction not terminated
- CData section not finished
- Error parsing attribute name
- Double hyphen within comment
- CharRef: invalid decimal value
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.