Controlling the order of XML namepaces

前端 未结 6 1162
你的背包
你的背包 2021-01-15 00:26

I\'m having a problem getting the \"xmlns\" to appear first in the root attribute list.

Im getting this:

  

        
6条回答
  •  天涯浪人
    2021-01-15 01:07

    Because sometimes the right answer is to say, no, don't do that...

    Per W3C Namespaces in XML Recommendation, section 3 Declaring Namespaces:

    [Definition: A namespace (or more precisely, a namespace binding) is declared using a family of reserved attributes. Such an attribute's name must either be xmlns or begin xmlns:. These attributes, like any other XML attributes, may be provided directly or by default. ]

    Therefore, the order of namespace declarations, like the order of any attributes, is insignificant.

    So, no conformant XML tool or library will care about the order of namespace declarations, and neither should you.

提交回复
热议问题