XML Schema attributeGroup要素
完全な XML Schema リファレンス
定義と使用法
attributeGroup 要素は属性宣言をグループ化するために使用され、それによりそれらの宣言をグループとして複合型に組み込むことができます。
要素情報
- 親要素: attributeGroup, complexType, schema, restriction (both simpleContent and complexContent), extension (both simpleContent and complexContent)
構文
<attributeGroup
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
(? 記号は、attributeGroup 要素内で要素が0回または1回出現できることを宣言します。* 記号は要素が0回以上出現できることを宣言します。)
| 属性 | 説明 |
|---|---|
| id | オプション。この要素の一意の ID を指定します。 |
| name | オプション。属性グループの名前を指定します。name 属性と ref 属性は同時に指定できません。 |
| ref | オプション。指定した属性グループへの参照を指定します。name 属性と ref 属性は同時に指定できません。 |
| any attributes | オプション。non-schema 名前空間を持つその他の任意の属性を指定します。 |
例 1
<xs:attributeGroup name="personattr">
<xs:attribute name="attr1" type="string"/>
<xs:attribute name="attr2" type="integer"/>
</xs:attributeGroup>
<xs:complexType name="person">
<xs:attributeGroup ref="personattr"/>
</xs:complexType>
<xs:attribute name="attr1" type="string"/>
<xs:attribute name="attr2" type="integer"/>
</xs:attributeGroup>
<xs:complexType name="person">
<xs:attributeGroup ref="personattr"/>
</xs:complexType>
上記の例では、"personattr" という名前の属性グループを定義し、"person" という名前の複合型で使用しています。
完全な XML Schema リファレンス
その他の拡張