如何制定 XSD
来源:互联网 发布:linux 不支持中文 编辑:程序博客网 时间:2024/04/28 14:55
XML documents can have a reference to a DTD or to an XML Schema.
XML文档能和一份DTD或XML Schema文件相关联。
A Simple XML Document
一份简单的XML文档
Look at this simple XML document called "note.xml":
请看下面名为"note.xml"的一份简易的XML文档
<?xml version="1.0"?><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>
A DTD File
一份DTD文件
The following example is a DTD file called "note.dtd" that defines the elements of the XML document above ("note.xml"):
下面的例子是名为"note.dtd"的DTD文件,它定义了上述XML文档("note.xml")的元素。
<!ELEMENT note (to, from, heading, body)><!ELEMENT to (#PCDATA)><!ELEMENT from (#PCDATA)><!ELEMENT heading (#PCDATA)><!ELEMENT body (#PCDATA)>
The first line defines the note element to have four child elements: "to, from, heading, body".
第一行定义了含有"to, from, heading, body".四个子元素的“note”元素。
Line 2-5 defines the to, from, heading, body elements to be of type "#PCDATA".
第2到5行定义了"#PCDATA". 类型的“to, from, heading, body”四个元素
An XML Schema
一份XML Schema
The following example is an XML Schema file called "note.xsd" that defines the elements of the XML document above ("note.xml"):
下面的例子当中,一个名为"note.xsd"的XML Schema文件定义了上述XML文档("note.xml")中的元素
<?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="http://www.w3schools.com"xmlns="http://www.w3schools.com"elementFormDefault="qualified">
<xs:element name="note"> <xs:complexType> <xs:sequence><xs:element name="to" type="xs:string"/><xs:element name="from" type="xs:string"/><xs:element name="heading" type="xs:string"/><xs:element name="body" type="xs:string"/> </xs:sequence> </xs:complexType></xs:element>
</xs:schema>
The note element is a complex type because it contains other elements. The other elements (to, from, heading, body) are simple types because they do not contain other elements. You will learn more about simple and complex types in the following chapters.
Note元素是复合类型(complex type)因为它包含了其他元素,其他元素(to, from, heading, body)属于简单类型(simple type),因为它不包含其他元素。在下面几章里你会学到更多关于简单类型和复合类型的相关知识。
A Reference to a DTD
和DTD相关
This XML document has a reference to a DTD:
XML文档和DTD相关:
<?xml version="1.0"?>
<!DOCTYPE note SYSTEM"http://www.w3schools.com/dtd/note.dtd">
<note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>
A Reference to an XML Schema
和XML Schema相关
This XML document has a reference to an XML Schema:
下面的XML文档和XML Schema相关:
<?xml version="1.0"?>
<notexmlns="http://www.w3schools.com"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.w3schools.com note.xsd"><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>
- 如何制定 XSD
- 如何定义Xsd文件
- 如何定义Xsd文件
- 如何定义Xsd文件
- 如何定义Xsd文件
- 如何定义Xsd文件
- 如何定义Xsd文件
- 如何定义Xsd文件
- 如何使用XSD
- 如何定义Xsd文件
- 如何定义Xsd文件
- 如何定义xsd文件
- 如何使用XSD
- 如何制定SQA计划
- 如何制定学习计划 - 褪墨
- 如何制定项目计划
- 如何制定测试计划
- 如何制定人生规划
- 为何使用 XML Schemas?
- acm比赛经验(转)
- ASCII码对照表
- 翻页导航控件
- Effective STL---50
- 如何制定 XSD
- 介绍一些经典的网站和书籍
- DB2常用的命令
- memset用法详解(转)
- 开博
- csdn百年难得一见的验证码
- linux下vi文本编辑器日常操作
- XSD - 元素
- 我的博客首页好像有问题