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