XML スキーマ group 要素
完全なXMLスキーマリファレンス
定義と用法
group 要素は、複合型定義で使用される要素のグループを定義するために使用されます。
要素情報
- 親要素: schema, choice, sequence, complexType, restriction
(simpleContent および complexContent の双方), extension (simpleContent および complexContent の双方)
構文
<group
id=ID
name=NCName
ref=QName
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
any attributes
>
(annotation?,(all|choice|sequence)?)
</group>
(group 要素内で、? 記号は要素が 0 または 1 回出現できることを宣言します)
属性 |
説明 |
id |
オプション。 要素へユニークな ID を指定する |
name |
オプション。group に対する名前を指定する。
この属性は、schema 要素がこの group 要素の親である場合にのみ使用される。
name と ref 属性の双方が存在することはできない |
ref |
オプション。他の group の名前を参照する。
name と ref 属性の双方が存在することはできない |
maxOccurs |
オプション。group 要素が、親要素で出現できる最大値を指定する。
値は、任意の数値 >= 0 にすることができる。また、最大数で上限を設定しない場合は、
値として "unbounded" を使用する。デフォルト値は 1 |
minOccurs |
オプション。group 要素が、親要素で出現できる最小値を指定する。
値は、任意の数値 >= 0 にすることができる。デフォルト値は 1 |
any attributes |
オプション。非スキーマ名前空間を持つ他の属性を指定する
|
例 1
次の例は、シーケンスを含む 4 つの要素の group を定義し、複合型定義で group 要素を使用しています:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:group name="custGroup">
<xs:sequence>
<xs:element name="customer" type="xs:string"/>
<xs:element name="orderdetails" type="xs:string"/>
<xs:element name="billto" type="xs:string"/>
<xs:element name="shipto" type="xs:string"/>
</xs:sequence>
</xs:group>
<xs:element name="order" type="ordertype"/>
<xs:complexType name="ordertype">
<xs:group ref="custGroup"/>
<xs:attribute name="status" type="xs:string"/>
</xs:complexType>
</xs:schema>
完全なXMLスキーマリファレンス
|