XMLスキーマsimpleType要素
❮完全なXMLスキーマリファレンス
定義と使用法
simpleType要素は、単純型を定義し、属性またはテキストのみの要素の値に関する制約と情報を指定します。
要素情報
- 親要素:属性、要素、リスト、制限、スキーマ、共用体
構文
<simpleType
id=ID
name=NCName
any attributes
>
(annotation?,(restriction|list|union))
</simpleType>
(?記号は、要素がsimpleType要素内で0回または1回発生する可能性があることを宣言します)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
name | Specifies a name for the element. This attribute is required if the simpleType element is a child of the schema element, otherwise it is not allowed |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
例1
この例では、制限付きの単純なタイプである「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>
❮完全なXMLスキーマリファレンス