ホーム HTML CSS XML JAVASCRIPT   PHP SQL MORE...   リファレンス 事例集    

XML スキーマ attributeGroup 要素


XML Schema Reference 完全な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>

(attributeGroup 要素内で、? 記号は要素が 0 または 1 回出現できることを宣言します)

属性 説明
id オプション。 要素へユニークな ID を指定する
name オプション。属性グループの名前を指定する。name と ref 属性の両方が存在することはできない
ref オプション。名前付き属性グループへの参照を指定する。name と ref 属性の両方が存在することはできない
any attributes オプション。非スキーマ名前空間を持つ他の属性を指定する

例 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 Schema Reference 完全なXMLスキーマリファレンス