当前位置: 首页 > 网络学院 > XML相关教程 > Schema (XSD) > XML Schema simpleContent 元素
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 元素包含了仅支持文本的复合类型元素或简单类型元素的扩展类内容或限制类内容,它不包含元素。
<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命名空间的属性 |
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> |