-->

XML version 1.1 not accepted by browsers?

2019-04-08 14:32发布

问题:

I have a program that produces rather vanilla XML documents. The first line of such generated documents is

<?xml version="1.1"?>

IE8 and Firefox both object to this, by complaining "Wrong version" and explicitly pointing to the "1.1" part.

If I patch the first line to say:

<?xml version="1.0"?>

both of them will load/show me document without complaint.

Isn't XML version 1.1 a standard? Do the browsers really not accept these? Or is the error message (like with most software error messages) simply misleading and something else is wrong?

回答1:

XML 1.1 is not the defacto standard, no. It's very rarely used, and unless you have a specific reason to use it, you should ignore it.

http://en.wikipedia.org/wiki/Xml

The second (XML 1.1) was initially published on February 4, 2004, the same day as XML 1.0 Third Edition,[32] and is currently in its second edition, as published on August 16, 2006. It contains features (some contentious) that are intended to make XML easier to use in certain cases.[33] The main changes are to enable the use of line-ending characters used on EBCDIC platforms, and the use of scripts and characters absent from Unicode 3.2. XML 1.1 is not very widely implemented and is recommended for use only by those who need its unique features.



回答2:

XML 1.1 seems to have acheived very little acceptance. 1.0 is very much more common.