XML Schema 教程教程
XML Schema simpleContent 元素
XML Schema simpleContent 元素
XML Schema simpleContent 元素
完整 XML Schema 参考手册
定义和用法
simpleContent 元素包含对 complexType 元素(它以字符数据或 simpleType 元素为内容)的扩展或限制并且不包含任何元素。
元素信息
- 父元素: complexType
语法
<simpleContent
id=ID
any attributes
>
(annotation?,(restriction|extension))
</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>
<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 simpleContent 元素 |
---|
XML Schema 教程
XML Schema 是基于 XML(可扩展标记语言),描述了 XML 文档的合法构建模块,可替代 DTD(文档类型定义)。XML Schema 是 W3C 的推荐标准。