XSD 복합 타입 - 요소만 포함
- 이전 페이지 XSD 빈 요소
- 다음 페이지 XSD 텍스트만 포함
“요소만 포함” 복합 유형 요소는 다른 요소만 포함할 수 있는 요소입니다.
복합 유형은 요소만 포함합니다
XML 요소, "person"은 다른 요소를 포함합니다:
<person> <firstname>John</firstname> <lastname>Smith</lastname> </person>
스키마에서 "person" 요소를 이렇게 정의할 수 있습니다:
<xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element>
이 <xs:sequence>를 주의하세요. 이는 정의된 요소가 "person" 요소에서 위의 순서로 나타나야 한다는 것을 의미합니다.
复杂性형 요소에 이름을 설정할 수 있으며, "person" 요소의 type 속성이 이 이름을 참조하도록 할 수 있습니다. (이 방법을 사용하면 여러 요소가 동일한 복합 유형을 참조할 수 있습니다.):
<xs:element name="person" type="persontype"/> <xs:complexType name="persontype"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complexType>
- 이전 페이지 XSD 빈 요소
- 다음 페이지 XSD 텍스트만 포함