Internet Explorer以随机顺序显示XML属性

Ian*_*oyd 6 xml internet-explorer internet-explorer-10

xml在Internet Explorer(9,Windows 7 64位)中打开一个文件.

Internet Explorer喜欢以随机顺序显示元素属性,例如:

在此输入图像描述

而不是按照声明的顺序:

<ApplicationVersion major="2" minor="2" release="12" build="687">2.2.12.687</ApplicationVersion>
Run Code Online (Sandbox Code Playgroud)

例如:

在此输入图像描述

要么

在此输入图像描述

而不是:

在此输入图像描述

是否存在元素,属性,xml-dtd,xml-schema,Internet Explorer选项,Windows选项,它们将指示IE以声明的方式显示XML,而不是随机顺序?

Col*_*n D 3

根据 xml 标准的定义,属性是无序的。

从标准:

Note that the order of attribute specifications in a start-tag or empty-element tag is not significant.
Run Code Online (Sandbox Code Playgroud)

http://www.w3.org/TR/REC-xml/#sec-starttags

如果您需要属性的顺序,则必须更改标记。我建议如下:

<ApplicationVersion>
  <attribute name="major">2</attribute>
  <attribute name="minor">2</attribute>
  <attribute name="build">687</attribute>
</ApplicationVersion>
Run Code Online (Sandbox Code Playgroud)

链接:
DOM 处理后 XML 属性的顺序
我可以使用模式强制执行 XML 属性的顺序吗?