XML 스키마 complexType 요소
❮ 완전한 XML 스키마 참조
정의 및 사용
complexType 요소는 복합 유형을 정의합니다. 복합 유형 요소는 다른 요소 및/또는 특성을 포함하는 XML 요소입니다.
요소 정보
- 상위 요소: 요소, 재정의, 스키마
통사론
<complexType
id=ID
name=NCName
abstract=true|false
mixed=true|false
block=(#all|list of (extension|restriction))
final=(#all|list of (extension|restriction))
any attributes
>
(annotation?,(simpleContent|complexContent|((group|all|
choice|sequence)?,((attribute|attributeGroup)*,anyAttribute?))))
</complexType>
(? 기호는 요소가 0번 또는 1번 발생할 수 있음을 선언하고 * 기호는 요소가 complexType 요소 내에서 0번 이상 발생할 수 있음을 선언합니다)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
name | Optional. Specifies a name for the element |
abstract | Optional. Specifies whether the complex type can be used in an instance document. True indicates that an element cannot use this complex type directly but must use a complex type derived from this complex type. Default is false |
mixed | Optional. Specifies whether character data is allowed to appear between the child elements of this complexType element. Default is false. If a simpleContent element is a child element, the mixed attribute is not allowed! |
block | Optional. Prevents a complex type that has a specified type
of derivation from being used in place of this complex type. This value can
contain #all or a list that is a subset of extension or restriction:
|
final | Optional. Prevents a specified type of derivation of this
complex type element. Can contain #all or a list that is a subset of
extension or restriction.
|
any attributes | Optional. Specifies any other attributes with non-schema namespace |
실시예 1
다음 예에는 복합 유형의 "note"라는 요소가 있습니다.
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
실시예 2
다음 예제에는 세 가지 추가 요소(주소, 도시 및 국가)로 상속된 유형을 확장하여 다른 복합 유형인 "personinfo"에서 파생된 복합 유형 "fullpersoninfo"가 있습니다.
<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" 요소를 순서대로 포함해야 합니다.
❮ 완전한 XML 스키마 참조