XMLスキーマattributeGroup要素
❮完全なXMLスキーマリファレンス
定義と使用法
attributeGroup要素は、属性宣言のセットをグループ化するために使用されます。これにより、属性宣言をグループとして複合型定義に組み込むことができます。
要素情報
- 親要素: attributeGroup、complexType、schema、restriction(simpleContentとcomplexContentの両方)、extension(simpleContentとcomplexContentの両方)
構文
<attributeGroup
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
(?記号は、要素が0回または1回発生する可能性があることを宣言し、*記号は、要素がattributeGroup要素内で0回以上発生する可能性があることを宣言します)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
name | Optional. Specifies the name of the attribute group. Name and ref attributes cannot both be present |
ref | Optional. Specifies a reference to a named attribute group. Name and ref attributes cannot both be present |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
例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>
上記の例では、「person」という名前の複合型で使用される「personattr」という名前の属性グループを定義しています。
❮完全なXMLスキーマリファレンス