XML Schema simpleContent 元素


XML Schema 參考手冊 完整 XML Schema 參考手冊

定義和用法

simpleContent 元素包含對 complexType 元素(它以字元數據或 simpleType 元素為內容)的擴展或限制並且不包含任何元素。

元素資訊

  • 父元素: complexType

語法

<simpleContent
id=ID
any attributes
>

(annotation?,(restriction|extension))

</simpleContent>

(? 符號聲明在 simpleContent 元素中該元素可出現零次或一次。)

屬性 描述
id 可選。規定該元素的唯一的 ID。
any attributes 可選。規定帶有 non-schema 命名空間的任何其他屬性。

實例 1

這是一個僅包含文本的 XML 元素 (<shoesize>):

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

下麵的例子聲明了一個複雜類型 "shoesize",其內容被定義為整數數據類型,並帶有一個 country 屬性:

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


XML Schema 參考手冊 完整 XML Schema 參考手冊