最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

如何使用 XSD?

XML 文檔可對 DTD 或 XML Schema 進(jìn)行引用。

一個簡單的 XML 文檔:

請看這個名為 "note.xml" 的 XML 文檔:

<?xml version="1.0"?>
<note>
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>
</note>

DTD 文件

下面這個例子是名為 "note.dtd" 的 DTD 文件,它對上面那個 XML 文檔的元素進(jìn)行了定義:

<!ELEMENT note (to, from, heading, body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>

第 1 行定義 note 元素有四個子元素:"to, from, heading, body"。

第 2-5 行定義了 to, from, heading, body 元素的類型是 "#PCDATA"。

XML Schema

下面這個例子是一個名為 "note.xsd" 的 XML Schema 文件,它定義了上面那個 XML 文檔的元素:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://m.fzitv.net"
xmlns="http://m.fzitv.net"
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>

note 元素是一個復(fù)合類型,因為它包含其他的子元素。其他元素 (to, from, heading, body) 是簡易類型,因為它們沒有包含其他元素。您將在下面的章節(jié)學(xué)習(xí)更多有關(guān)復(fù)合類型和簡易類型的知識。

對 DTD 的引用

此文件包含對 DTD 的引用:

<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "http://m.fzitv.net/dtd/note.dtd">
<note>
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>
</note>

對 XML Schema 的引用

此文件包含對 XML Schema 的引用:

<?xml version="1.0"?>
<note
xmlns="http://m.fzitv.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://m.fzitv.net note.xsd">

<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>
</note>
招远市| 山丹县| 营山县| 香河县| 吉隆县| 水富县| 琼海市| 上虞市| 刚察县| 鲁山县| 夏河县| 馆陶县| 沂南县| 荃湾区| 唐河县| 安化县| 淅川县| 镇坪县| 彩票| 阜康市| 敖汉旗| 宁国市| 西平县| 项城市| 六安市| 文安县| 兴和县| 阿瓦提县| 东安县| 泰顺县| 盘山县| 巴楚县| 尉犁县| 濮阳县| 嘉义市| 长葛市| 定结县| 博白县| 红桥区| 佛冈县| 综艺|