일부 XSD를 정의하는 방법으로 인해 XML에서 발생하는 데이터 순서에 특수한 중요성이 부여됩니다.
XSD에서의 순서 중요성에 대한 예로는 혼합 컨텐츠를 들 수 있습니다. 한 요소의 이전 또는 이후에 텍스트 데이터가 표시되는 경우 다른 위치에 표시되는 경우와는 다른 의미를 가질 수 있습니다. 이런 경우 SDO가 순서로 알려진 오브젝트를 생성하며 이는 순서를 지정하여 데이터를 설정하는 데 사용됩니다.
SDO 순서를 XSD 순서와 혼동해서는 안 됩니다. XSD 순서는 SDO 모델을 생성하기 전에 단일화되는 모델 그룹입니다. XSD 순서 표시는 SDO 순서 표시와 관련이 없습니다.
XSD의 다음 조건은 SDO 순서가 생성되게 합니다.
혼합 컨텐츠가 포함된 complexType:
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://MixedContent" targetNamespace="http://MixedContent"> <xsd:complexType name="MixedContent" mixed="true"> <xsd:sequence> <xsd:element name="element1" type="xsd:string" minOccurs="0"/> <xsd:element name="element2" type="xsd:string" minOccurs="0"/> <xsd:element name="element3" type="xsd:string" minOccurs="0"/> </xsd:sequence> </xsd:complexType> <xsd:element name="MixedContent" type="tns:MixedContent"/> </xsd:schema>
<any/> 태그가 하나 이상 있는 스키마:
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://AnyElemAny" targetNamespace="http://AnyElemAny"> <xsd:complexType name="AnyElemAny"> <xsd:sequence> <xsd:any/> <xsd:element name="marker1" type="xsd:string"/> <xsd:any/> </xsd:sequence> </xsd:complexType> </xsd:schema>
모델 그룹 배열(maxOccurs > 1인 모두, 선택사항, 순서 및 그룹 참조):
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://ModelGroupArray"> <xsd:complexType name="ModelGroupArray"> <xsd:sequence maxOccurs="3"> <xsd:element name="element1" type="xsd:string"/> <xsd:element name="element2" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema>
둘 이상의 요소가 포함된 maxOccurs <= 1인 <all/> 태그:
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://All"> <xsd:complexType name="All"> <xsd:all> <xsd:element name="element1" type="xsd:string"/> <xsd:element name="element2" type="xsd:string"/> </xsd:all> </xsd:complexType> </xsd:schema>
<any/>와 순서를 함께 사용하는 것에 대한 특정 정보는 이 페이지 맨 아래 나열되어 있는 주제에서 설명합니다. 이 섹션의 나머지 부분에 표시된 일반 정보에서는 기타 순서 조건에서 작업하는 방법에 대해 설명하며, 이는 여전히 <any/>에도 적용됩니다.