complexContent 定義の制約を定義します。
<restriction
base = QName
id = ID
{any attributes with non-schema Namespace}...>
Content: (annotation?, (group | all | choice | sequence)?, ((attribute |
attributeGroup)*, anyAttribute?))
</restriction>
属性
base
このスキーマ (または指定した名前空間で示される他のスキーマ) で定義されている complexType 要素の名前。restriction 要素を含んでいる要素は、base 値で指定した型から派生します。base 値は、修飾名 (QName) であることが必要です。
必ず指定します。
id
この要素の ID。id の値は ID 型である必要があり、この要素を含んでいるドキュメント内で一意である必要があります。省略可能です。
要素情報
出現回数 |
1 回 |
親要素 |
|
コンテンツ |
group、all、choice、sequence、attribute、attributeGroup、anyAttribute |
例
restriction を使用して複合型を定義する例を次に示します。複合型である USAddress
は、通常のアドレス複合型から派生した型であり、その country
要素は US
に固定されています。
<xs:complexType name="address">
<xs:sequence>
<xs:element name="street" type="xs:string" />
<xs:element name="city" type="xs:string" />
<xs:element name="zipcode" type="xs:integer" />
<xs:element name="country" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="USAddress">
<xs:complexContent>
<xs:restriction base="address">
<xs:sequence>
<xs:element name="street" type="xs:string" />
<xs:element name="city" type="xs:string" />
<xs:element name="zipcode" type="xs:integer" />
<xs:element name="country" type="xs:string" fixed="US" />
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>