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

XML スキーマ complexContent 要素


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

定義と用法

complexContent 要素は、mixed コンテンツまたは要素だけを含む複合型の拡張または制約を定義します。

要素情報

  • 親要素: complexType

構文

<complexContent
id=ID
mixed=true|false
any attributes

>

(annotation?,(restriction|extension))

</complexContent>

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

属性 説明
id オプション。 要素へユニークな ID を指定する
mixed オプション。文字データが、complexType 要素の子要素間に出現できるかどうかを指定する。 デフォルトは false
any attributes オプション。非スキーマ名前空間を持つ他の属性を指定する

例 1

次の例は、3つの追加要素(address、city、country)で継承した型を拡張することにより、 別の複合型 "personinfo" から派生した複合型、"fullpersoninfo"があります:

<xs:element name="employee" type="fullpersoninfo"/>

<xs:complexType name="personinfo">
  <xs:sequence>
    <xs:element name="firstname" type="xs:string"/>
    <xs:element name="lastname" type="xs:string"/>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="fullpersoninfo">
  <xs:complexContent>
    <xs:extension base="personinfo">
      <xs:sequence>
        <xs:element name="address" type="xs:string"/>
        <xs:element name="city" type="xs:string"/>
        <xs:element name="country" type="xs:string"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

上記例で、"employee" 要素には、次の順で要素が含まれている必要があります: "firstname"、"lastname"、"address"、"city"、"country"。


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