Internet Explorer displaying XML attributes in random order

对着背影说爱祢 提交于 2019-12-05 10:12:41
Colin D

Attributes are unordered as defined by the xml standard.

from the 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 11 also has this disappointing failure to xml display as written.

Use Chrome instead to display xml, it also has colour syntax highlighting.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!