XML Schema simpleContent要素

定義と使用方法

simpleContent要素は、characterデータまたはsimpleType要素を内容とするcomplexType要素の拡張または制限を含み、要素を含まないことができます。

要素情報

出現回数 一度
親要素 complexType
内容

オプション - annotation

必須オプション - 下記の要素を1つまたは1つ以上指定します:restriction (simpleContent)またはextension (simpleContent)。

構文

<simpleContent
id=ID
any attributes
>
(annotation?,(restriction|extension))
</simpleContent>

(?シンボルはsimpleContent要素内で、この要素は0回または1回のみ出現します。)

属性 説明
id オプション。この要素のユニークなIDを指定します。
any attributes オプション。非スキーマ名前空間を持つ他の属性を指定します。

例1

これはテキストのみを含むXML要素(<shoesize>)です:

<shoesize country="france">35</shoesize>

以下の例では、整数データ型であり、country属性を持つ複雑な型「shoesize」を宣言しています:

<xs:element name="shoesize">
  <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="xs:integer">
        <xs:attribute name="country" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>