2017-01-26 8 views
1

, 예컨대 :차이점/유사점 요소 구속되지 않은 요소의 차이는 무엇

<?xml version="1.0" encoding="utf-8"?> 
<xs:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:tns="http://tempuri.org/import" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:element name="a"></xs:element> 
</xs:schema> 

입력 xs:anyType와 요소, 예컨대 :

<?xml version="1.0" encoding="utf-8"?> 
<xs:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:tns="http://tempuri.org/import" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:element name="b" type="xs:anyType"></xs:element> 
</xs:schema> 

?

두 가지 모두 콘텐츠를 허용하며 제약 조건을 적용하지 않습니다. 어떤 차이가 있습니까? 관련 사양을 살펴 봤지만 그 차이점에 대한 혼란은 분명하지 않습니다.

답변

2

차이는 없습니다.

xs:element/@type의 기본값은 ur-type이고, 그렇지 않으면 anyType입니다.

3.3.2 XML Representation of Element Declaration Schema Components 참조 :

{type definition} : 타입 정의는 [children]<simpleType> 또는 <complexType> 요소 정보 항목에 대응하는 하나가 존재하는 경우, 달리 type 정의 ·resolved··actual value·를 의해 [attribute] 유형의 경우 의 ~ substitutionGroup[attribute], 존재하는 경우, 그렇지 않으면 ·ur-type definition·.

2.2.1.1 Type Definition Hierarchy 참조 :

[정의 :] 저명한 복합 유형 정의, 이름이 XML 스키마 네임 스페이스 anyType에있는 UR 형 정의는, 존재 각 ·XML Schema·에 해당 스키마의 정의 계층 구조의 루트로 사용됩니다.

관련 :XML Schema: what's the default type of an xsd:attribute?