Internet Explorer以随机顺序显示XML属性 [英] Internet Explorer displaying XML attributes in random order
问题描述
我正在Internet Explorer(9,Windows 7 64位)中打开xml
文件.
i am opening an xml
file in Internet Explorer (9, Windows 7 64-bit).
Internet Explorer喜欢按随机顺序显示元素属性,例如:
Internet Explorer likes to display element attributes in random order, e.g.:
而不是按照声明的顺序:
rather than in declared order:
<ApplicationVersion major="2" minor="2" release="12" build="687">2.2.12.687</ApplicationVersion>
例如:
或
而不是:
在指示IE以声明的顺序而不是随机的顺序显示XML的位置上是否有元素,属性,xml-dtd,xml-schema,Internet Explorer选项,Windows选项?
Is there an element, attribute, xml-dtd, xml-schema, Internet Explorer option, Windows option anywhere that will instruct IE to display the XML in declared, rather than random order?
推荐答案
属性按照xml标准的定义是无序的.
Attributes are unordered as defined by the xml standard.
根据标准:
Note that the order of attribute specifications in a start-tag or empty-element tag is not significant.
http://www.w3.org/TR/REC- xml/#sec-starttags
如果您需要在属性中订购,则必须更改标记.我建议如下所示:
If you require order in attributes you are going to have to change your markup. I suggest something like the following:
<ApplicationVersion>
<attribute name="major">2</attribute>
<attribute name="minor">2</attribute>
<attribute name="build">687</attribute>
</ApplicationVersion>
links:
Order of XML attributes after DOM processing
Can I enforce the order of XML attributes using a schema?
这篇关于Internet Explorer以随机顺序显示XML属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!