XML Schema complexContent 요소
정의와 사용법
complexContent 요소는 복잡한 타입(혼합 내용이 포함된 경우 또는 요소만 포함된 경우)에 대한 확장 또는 제한을 정의합니다.
요소 정보
출현 횟수 | 한 번 |
부모 요소 | complexType |
내용 |
선택 사항. annotation 필수 사항. 다음 중 하나만 있어야 합니다: restriction (complexContent) 또는 extension (complexContent). |
문법
<complexContent id=ID mixed=true|false any attributes > (annotation?,(restriction|extension)) </complexContent>
(? 기호는 complexContent 요소 내에서 0회나 1회만 나타날 수 있습니다.)
속성 | 설명 |
---|---|
id | 선택 사항. 요소의 독특한 ID를 정의합니다. |
mixed | 선택 사항. complexType 요소의 자식 요소 사이에 문자 데이터가 나타날 수 있는지 정의합니다. 기본 값은 false입니다. |
any attributes | 선택 사항. non-schema 이름 공간을 가진 모든 다른 속성을 정의합니다. |
예제
이 예제에서 복잡한 타입 "fullpersoninfo"가, 세 가지 추가 요소를 사용하여 상속 타입에서 확장된 "personinfo" 복잡한 타입에서 파생되었습니다:
<xs:element name="employee" type="fullpersoninfo"/> <xs:complexType name="personinfo"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="fullpersoninfo"> <xs:complexContent> <xs:extension base="personinfo"> <xs:sequence> <xs:element name="address" type="xs:string"/> <xs:element name="city" type="xs:string"/> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>
위의 예제에서, "employee" 요소는 "firstname", "lastname", "address", "city" 및 "country" 요소를 순서대로 포함해야 합니다.