XML Schema simpleContent 要素

定義と使用方法

simpleContent 要素は、ctypeComplexType 要素(文字データまたは simpleType 要素が内容)の拡張または制限を含み、要素を含まない場合があります。

要素情報

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

オプション — annotation

必須オプション — 以下の要素が 1 つしか存在しない場合: restriction (simpleContent) または extension (simpleContent)。

構文

<simpleContent
id=ID
任意の属性
>
(annotation?,(restriction|extension))
</simpleContent>

(? 符号は simpleContent 要素内でこの要素が 0 回または 1 回出现することができます。)

属性 説明
id オプション。この要素のユニークな ID を指定します。
任意の属性 オプション。non-schema 名前空間を持つ任意の他の属性を指定します。

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