Preserving XML attribute order?

前端 未结 1 825
南旧
南旧 2021-01-23 08:44

I know this question has been asked in the past, but they have all been dated a few years back. I am wondering if there has been any changes made to Python modules such as lxml,

相关标签:
1条回答
  • 2021-01-23 09:06

    The insignificance of attribute ordering is not a technical limitation to be lifted in future implementations of XML libraries.

    Attribute order is insignificant per the XML Recommendation:

    Note that the order of attribute specifications in a start-tag or empty-element tag is not significant.

    Thus, you should not base your design upon any particular ordering of attributes in XML.

    In the very rare circumstances where an application absolutely must order XML attributes, see the section on attribute processing in the XML Normalization Recommendation or the Canonical XML Recommendation.

    0 讨论(0)
提交回复
热议问题