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

XML スキーマ simpleType 要素


XML Schema Reference 完全なXMLスキーマリファレンス

定義と用法

simpleType 要素は、単純型を定義し、属性やテキストだけの要素の値に関する制約や情報を指定します。

要素情報

  • 親要素: attribute, element, list, restriction, schema, union

構文

<simpleType
id=ID
name=NCName
any attributes
>

(annotation?,(restriction|list|union))

</simpleType>

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

属性 説明
id オプション。 要素へユニークな ID を指定する
name 要素の名前を指定します。この属性は、 simpleType 要素が schema 要素の子である場合は必須で、それ以外は使用できない
any attributes オプション。非スキーマ名前空間を持つ他の属性を指定する

例 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>


XML Schema Reference 完全なXMLスキーマリファレンス