2016-08-04 3 views
1

여기에서 찾을 수 있습니다 XML 정규화에 대한 공식 테스트 케이스가 있습니다 그 중 Test cases for Canonical XML 2.0XML 정규화의 사전 편찬

하나는 다음과 같습니다

<!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"보다 먼저 나오는 이유가 궁금합니다. 누군가가 명확하게 말할 수 있다면 정말 감사 할 것입니다. ify 나를 위해.

답변

0

네임 스페이스 접두사를 보지 마십시오. 네임 스페이스 URI를 보라.

b 전에 iw 앞에 오는 a가 온다 있지만 :

xmlns:b="http://www.ietf.org" 
    xmlns:a="http://www.w3.org" 

따라서 b:attr="sorted"는 canonically a:attr="out" 전에 온다.

section 2.3에 설명되어 있습니다 :

가 : 기본 키가 네임 스페이스 URI하지 네임 스페이스 접두사

때문에 e5에서 b:attra:attr 앞에