simpleType 定義の制約を定義します。
<restriction
base = QName
id = ID
{any attributes with non-schema Namespace}...>
Content: (annotation?, (simpleType?, (minExclusive | minInclusive |
maxExclusive | maxInclusive | totalDigits |fractionDigits | length |
minLength | maxLength | enumeration | whiteSpace | pattern)*))
</restriction>
属性
base
組み込みデータ型の名前か、またはスキーマ (または指定した名前空間によって示される他のスキーマ) に定義されている simpleType 要素の名前。restriction 要素を含んでいる要素は、base 値で指定した型から派生します。base 値は、修飾名 (QName) であることが必要です。
必ず指定します。
id
この要素の ID。id の値は ID 型である必要があり、この要素を含んでいるドキュメント内で一意である必要があります。省略可能です。
要素情報
出現回数 |
1 回 |
親要素 |
|
コンテンツ |
annotation、fractionDigits、enumeration、length、maxExclusive、maxInclusive、maxLength、minExclusive、minInclusive、minLength、pattern、simpleType、totalDigits、whiteSpace |
例
制限を使用する単純型の定義例を次に示します。単純型を nonNegativeInteger から派生させ、その maxInclusive 値を 100
に設定します。
<xs:simpleType name="freezeboilrangeInteger">
<xs:restriction base="xs:nonNegativeInteger">
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
例
integer 組み込み型から派生し、integer のすべてのファセットを持つ (制限なし) 単純型の定義例を次に示します。
<xs:simpleType name="myInteger">
<xs:restriction base="xs:integer"/>
</xs:simpleType>
例
string から派生し、列挙型である単純型の定義例を次に示します。値セットは指定した値に制限します。
<xs:simpleType name="mountainbikesize">
<xs:restriction base="xs:string">
<xs:enumeration value="small"/>
<xs:enumeration value="medium"/>
<xs:enumeration value="large"/>
</xs:restriction>
</xs:simpleType>