次の方法で共有


extension (simpleContent)

simpleContent の拡張を定義します。指定された属性、属性グループ、または anyAttribute を追加することによって、単純コンテンツを持つ単純型または複合型を拡張します。

<extension
  base = QName
  id = ID 
  {any attributes with non-schema Namespace}...>
Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?))
</extension>

属性

  • base
    組み込みデータ型の名前は、simpleType 要素か、または単純なコンテンツを持つ complexType です。

    base 値は、限定名 (QName) であることが必要です。

    必ず指定します。

  • id
    この要素の ID。id の値は ID 型である必要があり、この要素を含んでいるドキュメント内で一意である必要があります。

    省略可能です。

要素情報

出現回数 1 回
親要素 simpleContent
コンテンツ annotationattributeattributeGroupanyAttribute

列挙属性を追加して、定義済みの simpleType を拡張する例を次に示します。

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

<xs:complexType name="FamilyMountainBikes">
  <xs:simpleContent>
    <xs:extension base="mountainBikeSize">
      <xs:attribute name="familyMember">
      <xs:restriction base="xs:string">
        <xs:enumeration value="child" />
        <xs:enumeration value="male" />
        <xs:enumeration value="female" />
      </xs:restriction>
    </xs:attribute>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>

参照

XML スキーマ リファレンス (XSD) | XML スキーマの要素

詳細については、http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-simpleContent::extension で、W3C『XML Schema Part 1: Structures Recommendation』を参照してください。