XML Schema学习笔记 (二) XML 相关

2009-03-30 18:39:59 作者:ASP编程 来源:电脑高手哦 浏览次数:0 网友评论 0

<xsd:attribute name="currency" type="xsd:string"/>              <xsd:attribute name="value"?type="xsd:decimal"/>              </xsd:complexContent>              </xsd:element>              第

<xsd:attribute name="currency" type="xsd:string"/>

<xsd:attribute name="value"?type="xsd:decimal"/>

</xsd:complexContent>

</xsd:element>

第三种类型:

<xsd:element name="letterBody">

<xsd:complexType mixed="true">

<xsd:sequence>

<xsd:element name="salutation">

<xsd:complexType mixed="true">

<xsd:sequence>

<xsd:element name="name" type="xsd:string"/>

</xsd:sequence>

</xsd:complexType>

</xsd:element>

<xsd:element name="quantity"type="xsd:positiveInteger"/>

<xsd:element name="productName" type="xsd:string"/>

<xsd:element name="shipDate"type="xsd:date" minOccurs="0"/>

</xsd:sequence>

</xsd:complexType>

</xsd:element>

第三种类型的实例可能如下:

<letterBody>

<salutation>Dear Mr.<name>Robert Smith</name>.</salutation>

Your order of <quantity>1</quantity> <productName>Baby

Monitor</productName> shipped from our warehouse on

<shipDate>1999-05-21</shipDate>

</letterBody>

12、根据11的描述那么要定义一个空内容的元素,也就是说定义一个只包含属性的元素,只要在complexContent中不包含任何子元素,就可以了,如:

<xsd:element name="internationalPrice">

<xsd:complexType>

<xsd:attribute name="currency" type="xsd:string"/>

<xsd:attribute name="value"type="xsd:decimal"/>

</xsd:complexType>

</xsd:element>

13anyType是所有Schema类型的基类型,和Java中的Object类似。因此,以下定义:

<xsd:element name="anything" type="xsd:anyType"/>

可以写成:

<xsd:element name="anything"/>

14Schema中用annotationdocumentappInfo三个元素来进行注释,其中appIdocument都是作为annotation的子元素来处理的。并且annotation一般是作为schema的顶层子元素、element的构造、类型定义的顶层子元素的。

如:

<xsd:element name="internationalPrice">

<xsd:annotation>

<xsd:documentation xml:lang="en">

element declared with anonymous type

</xsd:documentation>

</xsd:annotation>

<xsd:complexType>

<xsd:annotation>

<xsd:documentation xml:lang="en">

empty anonymous type with 2 attributes

</xsd:documentation>

</xsd:annotation>

<xsd:complexContent>

<xsd:restriction base="xsd:anyType">

<xsd:attribute name="currency" type="xsd:string"/>

<xsd:attribute name="value"type="xsd:decimal"/>

</xsd:restriction>

</xsd:complexContent>

</xsd:complexType>

XML Schema学习笔记 (二) XML 相关是www1098t.com的会员在asp编程最新发表的,同时也欢迎你就XML Schema学习笔记 (二) XML 相关提问.欢迎来到我们的服务器编程网站查询笔记的文章.
关键词:笔记

相关文章

[错误报告] [推荐] [收藏] [打印] [关闭] [返回顶部]

  • 验证码:

最新图片文章

最新文章