XML Schema attributeGroup 要素
定義と用法
attributeGroup 要素は属性宣言を組み合わせるために使用され、これらの宣言は複雑なタイプに組み合わせて統合されることができます。
要素情報
出現回数 | 制限なし |
親要素 | attributeGroup、complexType、schema、restriction (simpleContent)、extension (simpleContent)、restriction (complexContent)、extension (complexContent) |
内容 | 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 命名空間的任何其他屬性。 |
例
<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>
上記の例では、"personattr"と名付けられた属性グループが定義されており、"person"と名付けられた複雑なタイプで使用されています。