XSD Complex 空元素
来源:互联网 发布:双十一淘宝店铺装修 编辑:程序博客网 时间:2024/04/28 21:28
An empty complex element cannot have contents, only attributes.
一个空的复合元素不能含有内容,只能含有属性。
Complex Empty Elements
复合空元素(Complex Empty Elements)
An empty XML element:
一个空的XML元素:
<product prodid="1345" />
The "product" element above has no content at all. To define a type with no content, we must define a type that allows only elements in its content, but we do not actually declare any elements, like this:
上述"product"元素完全不含内容。为定义不含内容的类型,我们必须定义一个内容中只允许出现元素的类型,但我们不需要声明任何元素,就像这样:
<xs:element name="product"> <xs:complexType> <xs:complexContent> <xs:restriction base="xs:integer"> <xs:attribute name="prodid" type="xs:positiveInteger"/> </xs:restriction> </xs:complexContent> </xs:complexType></xs:element>
In the example above, we define a complex type with a complex content. The complexContent element signals that we intend to restrict or extend the content model of a complex type, and the restriction of integer declares one attribute but does not introduce any element content.
上述例子中,我们定义了一个有复合内容的复合类型。复合内容的元素表示了我们想要约束或扩充的复合类型的内容模式。对整数的约束声明了一个属性,但并没有介绍任何元素内容。
However, it is possible to declare the "product" element more compactly, like this:
但是,可以更加简洁地声明"product"元素,就像这样:
<xs:element name="product"> <xs:complexType> <xs:attribute name="prodid" type="xs:positiveInteger"/> </xs:complexType></xs:element>
Or you can give the complexType element a name, and let the "product" element have a type attribute that refers to the name of the complexType (if you use this method, several elements can refer to the same complex type):
或者你可以给complexType元素起个名称,并让"product"元素有个类型属性,而且类型属性引用的是complexType的名称(如果你用这个方法,几个元素可以引用相同的复合类型):
<xs:element name="product" type="prodtype"/>
<xs:complexType name="prodtype"> <xs:attribute name="prodid" type="xs:positiveInteger"/></xs:complexType>
- XSD Complex 空元素
- XSD Complex 元素
- XML简介之Schema之XSD 复合空元素 VS XSD 复合类型 - 仅含元素
- XSD - 元素
- XSD 元素
- XSD Simple 元素
- XSD anyAttribute元素
- XSD 元素替代
- XSD - <schema> 元素
- XSD 复合元素
- XSD <anyAttribute> 元素
- XSD简易元素
- XSD复合元素
- 7. XSD 简易元素
- 8.XSD 复合元素
- 10.XSD 元素替换
- XSD 复合元素
- Schema元素xsd:key和xsd:keyref
- VC调试入门
- Markup之美,初学者应该处理好UI与业务逻辑间的关系
- Authorization Mechanisms(认证机制)
- 利用apache poi读取excel的一个小例子
- 大阪第17天——清明古诗
- XSD Complex 空元素
- ASP.Net中用C#实现站点计数器用户控件
- MySQL LOAD DATA Trick
- ASP运作方式浅析
- C#调用cmd.exe程序和外部程序
- 老公,抱我一分钟,好吗?---感人
- MySQL: ibdata files do not shrink on database deletion [innodb]
- c语言图片不初始化解决方法?
- 单例模式