XML规范化词典排序
这里有XML规范化的官方测试用例: 其中一个看起来像这样:XML规范化词典排序,xml,canonicalization,Xml,Canonicalization,这里有XML规范化的官方测试用例: 其中一个看起来像这样: <!DOCTYPE doc [<!ATTLIST e9 attr CDATA "default">]> <doc> <e1 /> <e2 ></e2> <e3 name = "elem3" id="elem3" /> <e4 name="elem4" id="elem4" ></e
<!DOCTYPE doc [<!ATTLIST e9 attr CDATA "default">]>
<doc>
<e1 />
<e2 ></e2>
<e3 name = "elem3" id="elem3" />
<e4 name="elem4" id="elem4" ></e4>
<e5 a:attr="out" b:attr="sorted" attr2="all" attr="I'm"
xmlns:b="http://www.ietf.org"
xmlns:a="http://www.w3.org"
xmlns="http://example.org"/>
<e6 xmlns="" xmlns:a="http://www.w3.org">
<e7 xmlns="http://www.ietf.org">
<e8 xmlns="" xmlns:a="http://www.w3.org">
<e9 xmlns="" xmlns:a="http://www.ietf.org"/>
</e8>
</e7>
</e6>
</doc>
给定的规范化形式是
<doc>
<e1></e1>
<e2></e2>
<e3 id="elem3" name="elem3"></e3>
<e4 id="elem4" name="elem4"></e4>
<e5 xmlns="http://example.org" xmlns:a="http://www.w3.org" xmlns:b="http://www.ietf.org" attr="I'm" attr2="all" b:attr="sorted" a:attr="out"></e5>
<e6>
<e7 xmlns="http://www.ietf.org">
<e8 xmlns="">
<e9 attr="default"></e9>
</e8>
</e7>
</e6>
</doc>
我想知道为什么排序输出中
b:attr=“sorted”
出现在a:attr=“out”
之前。。。如果有人能为我澄清这一点,我将不胜感激。不要看名称空间前缀;看看名称空间URI
虽然a
在b
之前,但i
在w
之前:
xmlns:b="http://www.ietf.org"
xmlns:a="http://www.w3.org"
因此b:attr=“sorted”
通常在a:attr=“out”
之前出现
下文对此进行了解释:
注意:在e5
中,b:attr
位于a:attr
之前,因为主键是命名空间URI而不是命名空间前缀
不要看名称空间前缀;看看名称空间URI 虽然
a
在b
之前,但i
在w
之前:
xmlns:b="http://www.ietf.org"
xmlns:a="http://www.w3.org"
因此b:attr=“sorted”
通常在a:attr=“out”
之前出现
下文对此进行了解释:
注意:在e5
中,b:attr
位于a:attr
之前,因为主键是命名空间URI而不是命名空间前缀