Latest web development tutorials

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參考手冊