写XML版本的目的是什么?

What is the purpose of writing XML version?

我是XML的新手,我想了解基础知识。

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

在上面的xml代码中,

的目的是什么

version="1.0"

我知道这是 XML 版本。但问题是

目的是什么?

因为我进行了搜索,但没有找到可以向我澄清这一点的答案。 任何人都可以帮助我,如果这是重复的,请评论 link。 谢谢 Whosebug!

Version

Specifies the version of the XML standard that the XML document conforms to. The version attribute must be included if the XML declaration is declared well-formedness constraint

XML 文档中的第一行称为序言:

<?xml version="1.0" encoding="UTF-16" standalone="yes"?>

宣布 XML 版本尤为重要,因为 XML 1.1 已被批准为 W3C 推荐标准。 XML 1.1 以小而明确的方式改变了格式良好的定义。一个不错的变化是 XML 1.1 使 XML 声明成为强制性的。该建议指出: XML 1.1 文档必须以 XML 声明开头,声明所使用的 XML 版本。 重点是我的。根据定义,任何没有声明的 XML 文档都是 XML 1.0 文档。但是,您永远不应未说明版本,特别是因为指定编码也非常重要。