XML Schema simpleType要素
完全な XML Schema リファレンスマニュアル
定義と用法
simpleType 要素は、プレーンテキストコンテンツを持つ要素または属性の値に関する情報と、それらに対する制約を定義する単純型を定義します。
要素情報
- 親要素: attribute, element, list, restriction, schema, union
構文
<simpleType
id=ID
name=NCName
any attributes
>
(annotation?,(restriction|list|union))
</simpleType>
id=ID
name=NCName
any attributes
>
(annotation?,(restriction|list|union))
</simpleType>
(? 記号は、要素が simpleType 要素内に 0 回または 1 回出現できることを宣言します。)
| 属性 | 説明 |
|---|---|
| id | 任意。この要素の一意の ID を指定します。 |
| name |
型名。この名前は、XML 名前空間仕様で定義されているコロンなしの名前 (NCName) である必要があります。 指定する場合、その名前はすべての simpleType 要素と complexType 要素の中で一意である必要があります。 simpleType 要素が schema 要素の子要素である場合は必須です。それ以外の場合は許可されません。 |
| any attributes | 任意。non-schema 名前空間を持つその他の属性を指定します。 |
例 1
この例では、"age" 要素が制約付きの単純型であることを宣言します。age の値は 0 未満または 100 を超えることはできません:
<xs:element name="age">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
完全な XML Schema リファレンスマニュアル その他の拡張