动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
  
   Xml → 阅读文章

 XML Schema学习笔记 (二)

作者来源: 
阅读 1471 人次 , 2006-3-29 3:14:00 

<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 Schema学习笔记 (一)
· C++中处理XML文件
· PHP 和 XML: 使用expat函数(二)
· 用ASP、VB和XML建立互联网应用程序(3)
· 运用数据链路来显示XML文件(二)
· XML的一般信息


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077