当前位置: 首页 > 网络学院 > XML相关教程 > Schema (XSD) > XML Schema simpleContent 元素

Schema (XSD)
Schema (XSD) 介绍
为何使用 XML Schemas?
如何定制 XSD
XSD - <schema>元素
XSD 简单元素
XSD 属性
XSD 约束面
XSD 复合元素
XSD 复合空元素
XSD 复合纯元素
XSD 复合纯文本
XSD 混合内容的复合类型
XSD 指示器复合类型
XSD <any> 元素
XSD <anyAttribute> 元素
XSD 元素替代
XSD 实例
XSD 字符串数据类型
XSD 日期数据类型
XSD 小数数据类型

Schema (XSD) 中的 XML Schema simpleContent 元素


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 360 ::
收藏到网摘: n/a

Definition and Usage
定义和用法

The simpleContent element contains extensions or restrictions on a text-only complex type or on a simple type as content and contains no elements.
simpleContent 元素包含了仅支持文本的复合类型元素或简单类型元素的扩展类内容或限制类内容,它不包含元素。

Element Information
元素信息

  • Parent elements: complexType
    父类信息:complexType[复合类型]

Syntax
语法

<simpleContent
id=ID
any attributes
>
(annotation?,(restriction|extension))
</simpleContent>

(The ? sign declares that the element can occur zero or one time inside the simpleContent element)
“?”符号用于声明元素在simpleContent元素中允许出现的次数(0次或1次)

属性 描述
id Optional. Specifies a unique ID for the element
可选参数。为元素指定一个独立的ID
any attributes Optional. Specifies any other attributes with non-schema namespace
可选参数。指定其它的非schema命名空间的属性

Example 1
案例1

Here is an example of an XML element (<shoesize>) that contains text-only:
下面列举了一个XML元素的案例,该元素仅支持文本:

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

The following example declares a complexType, "shoesize", with its content defined as a integer data type and with a country attribute:
下面的案例声明了一个complexType[复合类型],并将其内容定义为一个整数型数据类型,并包含一个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>

评论 (0) All

登陆 | 还没注册?