XML Schema simpleContent 元素
❮ 完整的 XML Schema 參考
定義和用法
simpleContent 元素包含對僅文字的複雜型別或簡單型別的擴充套件或限制,並且不包含任何元素。
元素資訊
- 父元素: complexType
語法
<simpleContent
id=ID
任何屬性
>
(annotation?,(restriction|extension))
</simpleContent>
(? 符號表示該元素在 simpleContent 元素內可以出現零次或一次)
Attribute | 描述 |
---|---|
id | 可選。指定元素的唯一 ID |
any attributes | 可選。指定任何其他非 schema 名稱空間的屬性 |
示例 1
以下是一個 XML 元素 (<shoesize>) 的示例,它包含僅文字內容
<shoesize country="france">35</shoesize>
以下示例聲明瞭一個名為 "shoesize" 的複雜型別,其內容定義為 integer 資料型別,並帶有一個 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 參考