📄 day2_1.html
字号:
</tr>
<tr>
<td colspan="2">-<font color="#000000"><a href="../../1-download/page3.htm">网站设计</a></font></td>
</tr>
<tr>
<td colspan="2">-<font color="#000000"><a href="../../1-download/page4.htm">电子商务</a></font>
</td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#666699"><a href="../../1-teach/index.htm"><font color="#FFFFFF">实用技巧</font></a></td>
</tr>
<tr>
<td colspan="2">-<a href="../../1-teach/internet/index.htm">Internet应用</a></td>
</tr>
<tr>
<td colspan="2">-<a href="../../1-teach/photoshop/index.html">Photoshop</a></td>
</tr>
<tr>
<td colspan="2">-<a href="../../1-teach/flash/page1.html">Flash</a></td>
</tr>
<tr>
<td colspan="2">-<a href="../../1-teach/asp/index.html">ASP</a></td>
</tr>
<tr>
<td colspan="2">-<a href="../../1-teach/php/index.html">PHP</a></td>
</tr>
<tr>
<td colspan="2">-<a href="../../1-teach/java/index.htm">Java</a></td>
</tr>
<tr>
<td colspan="2">-<a href="../../1-teach/vb/index.htm">VB</a></td>
</tr>
<tr>
<td colspan="2">-<a href="../../1-teach/c/index.htm">C、C++</a></td>
</tr>
<tr>
<td colspan="2">-<a href="../../1-backend/database/php_mysql/index.html">PHP/MySQL</a></td>
</tr>
<tr>
<td colspan="2"><a href="../../1-backend/cgi_perl/perl_beginner/index.html">-Perl</a>
</td>
</tr>
<tr>
<td colspan="2">-<a href="../../1-teach/other/index.htm">其它</a> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#666699">
<div align="center"><font color="#FFFFFF">更多教程</font></div>
</td>
</tr>
<tr>
<td colspan="2" height="17"><a href="../../1hdml/index.html">-HDML</a></td>
</tr>
<tr>
<td colspan="2" height="23"><font face="宋体"><a href="../../1-backend/database/course/day1_1.html">-网络数据库</a></font></td>
</tr>
<tr>
<td colspan="2" height="14"><a href="../../1-backend/protocols/ping/index.html"><font face="arial, helvetica, sans-serif">Ping</font></a></td>
</tr>
<tr>
<td colspan="2" height="20"><a href="../../1-backend/cgi_perl/search_engine/index.html">-创建搜索引擎</a></td>
</tr>
<tr>
<td colspan="2" height="16">-<a href="../../1adobe/GoLive/index.html">Adobe GoLive</a></td>
</tr>
<tr>
<td colspan="2"><a href="../../1-backend/cgi_perl/templates/index.html">模板</a></td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#666699"><font color="#FFFFFF">合作伙伴</font></td>
</tr>
<tr>
<td colspan="2" align="left">-<a href="http://www.5dmedia.com/" target="_blank">5D精英网</a></td>
</tr>
<tr align="center">
<td colspan="2"> <img src="../../Library/front_monkey.gif" width="59" height="68"></td>
</tr>
</tbody>
</table>
<br><!-- #EndLibraryItem --></td>
<!-- End of headlines (column 1: left column) --> <!-- Gutter between columns 1 and 2 -->
<td width="10" height="794"><img src="http://www.sohu.com/images/pixel.gif" width=10></td>
<!-- Search box and directories (columns 2 and 3: middle columns, combined into one) -->
<td align=center valign=top width="558">
<div align="left"><!-- #BeginEditable "1" -->
<table border="0" width="550" cellspacing="0">
<tr>
<td width="458" valign="top" align="left"><br>
<strong>第一页:实现有效性</strong>
<p>最终我们将在组织良好的XML文档中加入信息。实际上,我们<br>
有很多事要做 - 仍然有危机潜伏 - 虽然XML文件组织良好,<br>
但还可能丢失关键信息。看看下面的例子:</p>
<pre><small><recipe> </small></pre>
<pre><small> <author>Carol Schmidt</author> </small></pre>
<pre><small> <recipe_name>Chocolate Chip Bars</recipe_name> </small></pre>
<pre><small> <meal>Dinner <course>Dessert</course> </meal> </small></pre>
<pre><small> <ingredients> </ingredients> </small></pre>
<pre><small> <directions>Melt butter; combine with, etc. ... </directions></small></pre>
<pre><small></recipe></small></pre>
<p>这份菜谱中没有包含ingredient,而且因为它组织良好,所以<br>
Lark分析器也不会发现问题。管理过哪怕是最和善的数据库的<br>
人都知道我们人类常犯的错误:如果有机会,我们会丢掉关键<br>
信息并加入无用的废话。这就是为什么XML的发明者引入DTD - <br>
文档类型定义(Document Type Definition)。DTD提供了一种保<br>
证XML或多或少是你所想的方法。</p>
<p>让我们看看用在菜谱上的一个DTD。</p>
<pre><small><!DOCTYPE list [ </small></pre>
<pre><small> <!ELEMENT recipe (recipe_name, author, meal, ingredients, directions)> </small></pre>
<pre><small> <!ELEMENT ingredients (item+)> </small></pre>
<pre><small> <!ELEMENT meal (#PCDATA, course?)> </small></pre>
<pre><small> <!ELEMENT item (#PCDATA, sub_item*)> </small></pre>
<pre><small> <!ELEMENT recipe_name (#PCDATA)> </small></pre>
<pre><small> <!ELEMENT author (#PCDATA)> </small></pre>
<pre><small> <!ELEMENT course (#PCDATA)> </small></pre>
<pre><small> <!ELEMENT item (#PCDATA)> </small></pre>
<pre><small> <!ELEMENT subitem (#PCDATA)> </small></pre>
<pre><small> <!ELEMENT directions (#PCDATA)></small></pre>
<pre><small>]></small></pre>
<p>这些代码起初看起来不够友好,但当把它分解时却能看出其中<br>
的意义。让我们详细解释之:</p>
<tt>
<p><!DOCTYPE list [</p>
</tt>
<p>这行是说,包含在方括号中的是具有根元素<list>的某个文档的<br>
DTD。如我们以前提到的,根元素包含所有其它元素。</p>
<tt>
<p><small><!ELEMENT recipe (recipe_name, meal, ingredients,
directions)></small></p>
</tt>
<p>这行定义了<recipe>标记符。圆括号是说其中的四种标记符必<br>
须按照顺序出现在<recipe>标记符中。</p>
<tt>
<p><small><!ELEMENT meal (#PCDATA, course?)></small></p>
</tt>
<p>这行需要详细的解释。我定义了以下的结构:</p>
<pre><small><meal><i>Here the meal name is mandatory</i> </small></pre>
<pre><small> <course><i>One course name may appear, but it is not</i></small></pre>
<pre><small><i> mandatory</i></course></small></pre>
<pre><small></meal></small></pre>
<p>我这样做是因为,按照我的想法,午餐不一定特定某道菜,但<br>
是晚餐可能要指出开胃食品、主菜和餐后甜点。通过指定<br>
#PCDATA - 表示经过分析的字符数据(即非二进制数据)来<br>
实现这个功能。这里,#PCDATA是文本 - 例如,“dinner”。</p>
<p>"course"后面的问号表示0或1对<course>标记符将出现在<meal><br>
标记符内。</p>
<p>现在让我们看看下一行:</p>
<tt>
<p><!ELEMENT ingredients (item+)></p>
</tt>
<p>这里的加号表示至少有一对<item>标记符应出现在<ingredients><br>
标记符内。</p>
<p>我们感兴趣的最后一行是:</p>
<tt>
<p><!ELEMENT item (#PCDATA, sub_item*)></p>
</tt>
<p>我把sub_item*作为一项安全措施。除了要求每个item的文本之<br>
外,我希望计算每个item的内容的数量。星号是说在<item>标记<br>
符中可以有子条目的数目。我不需要Chocolate Chip Bars菜谱的<br>
任何子条目,但是当它的组成成分很复杂时就用得着。</p>
<p>现在让我们把这些放在一起看看我们能得到什么。<a href="day2_2.html">>></a></p>
<p><strong>XML简介</strong><br>
<font color="#FF0000">第一页</font> 实现有效性<br>
<font color="#FF0000">第二页</font> <a href="day2_2.html">DTD的完整例子</a><br>
<font color="#FF0000">第三页</font> <a href="day2_3.html">XML的未来</a></p>
<p>[<a href="day1_1.html">第1天</a>][第2天]</p>
<hr align="left" width="95%">
<!--webbot bot="Include" U-Include="../../copyright.html" TAG="BODY" startspan -->
<p><font color="#000000"><span class="smallfont"><span class="smallfont">本栏目内容归<a href="http://www.hotwired.com">Wired
Digital Inc.</a>所有,任何单位或个人未经许可,不得擅自转载使用。 <a href="http://www.sohu.com">搜狐</a>公司制作完成。</span></span></font></p>
<!--webbot bot="Include" endspan i-checksum="15926" --> </td>
</tr>
</table>
<!-- #EndEditable --></div>
</td>
<!-- End of search box and directories (columns 2 and 3: middle columns, combined into one) -->
<!-- Gutter between columns 3 and 4 --> <!-- Other stuff (column 4: right column) -->
<!-- End of other stuff (column 4: right column) --> </tr>
</table>
<!-- End of table surrounding page contents -->
<hr noshade size=1 width=700>
<span class=eng><br>
Copyright (C) 1998-2000 Internet Technologies China. All rights reserved.
</span>
</center>
</body>
<!-- #EndTemplate --></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -