XMLスキーマcomplexContent要素
❮完全なXMLスキーマリファレンス
定義と使用法
complexContent要素は、混合コンテンツまたは要素のみを含む複合型の拡張または制限を定義します。
要素情報
- 親要素: complexType
構文
<complexContent
id=ID
mixed=true|false
any attributes
>
(annotation?,(restriction|extension))
</complexContent>
(?記号は、要素がcomplexContent要素内で0回または1回発生する可能性があることを宣言します)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
mixed | Optional. Specifies whether character data is allowed to appear between the child elements of this complexType element. Default is false |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
例1
次の例には、複合型「fullpersoninfo」があります。これは、継承された型を3つの追加要素(住所、都市、国)で拡張することにより、別の複合型「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」の要素が順番に含まれている必要があります。
❮完全なXMLスキーマリファレンス