⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dtd_intro.asp@output=print

📁 W3Schools tutorial..web designing
💻 ASP@OUTPUT=PRINT
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>Introduction to DTD</title>
 
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />

<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

</head>
<body>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>


<h1>Introduction to DTD</h1>

<a href="default.asp"><img alt="back" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="dtd_building.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>

<hr />
<p class="intro">A Document Type Definition (DTD) defines the legal building blocks of an XML
document. It defines the document structure with a list of legal elements and 
attributes.</p>
<p class="intro">A DTD
can be declared inline inside an XML document, or as an external reference.</p>
<hr />
<h2>Internal DTD Declaration</h2>

<p>If the DTD is declared inside the XML file, it should be wrapped in a DOCTYPE
definition with the following syntax:</p>

<table border="1" width="100%" class="ex" cellspacing="0">
<tr><td width="100%"><pre>&lt;!DOCTYPE root-element [element-declarations]&gt;</pre></td></tr>
</table>

<p>Example XML document with an internal DTD:</p>

<table border="1" width="100%" class="ex" cellspacing="0">
<tr><td width="100%"><pre>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!DOCTYPE note [
  &lt;!ELEMENT note (to,from,heading,body)&gt;
  &lt;!ELEMENT to      (#PCDATA)&gt;
  &lt;!ELEMENT from    (#PCDATA)&gt;
  &lt;!ELEMENT heading (#PCDATA)&gt;
  &lt;!ELEMENT body    (#PCDATA)&gt;
]&gt;
&lt;note&gt;
  &lt;to&gt;Tove&lt;/to&gt;
  &lt;from&gt;Jani&lt;/from&gt;
  &lt;heading&gt;Reminder&lt;/heading&gt;
  &lt;body&gt;Don't forget me this weekend&lt;/body&gt;
&lt;/note&gt;</pre></td></tr>
</table>
<br />

<a target="_blank" href="note_in_dtd.xml">Open
the XML file above in your browser</a>, and select view source or view page 
source to view the DTD.<p>The DTD above is interpreted like this:<br />
<b><br />
!DOCTYPE note</b>  defines that the root element of this document is <b>note.<br />
</b><b>!ELEMENT note</b>  defines that the <b>note</b> element contains
four elements: &quot;to,from,heading,body&quot;.<br />
<b>!ELEMENT to</b>  defines the <b>to</b> element&nbsp; to be of
the type &quot;#PCDATA&quot;.<br />
<b>!ELEMENT from</b>  defines the <b>from</b> element to be of the
type &quot;#PCDATA&quot;.<br />
<b>!ELEMENT heading</b> defines the <b>heading</b> element to be of the
type &quot;#PCDATA&quot;.<br />
<b>!ELEMENT body</b> defines the <b>body</b> element to be of the
type &quot;#PCDATA&quot;.</p>
<hr />
<h2>External DTD Declaration</h2>
<p>If the DTD is declared in an external file, it should be wrapped in a DOCTYPE
definition with the following syntax:</p>

<table border="1" width="100%" class="ex" cellspacing="0">
<tr><td width="100%"><pre>&lt;!DOCTYPE root-element SYSTEM &quot;filename&quot;&gt;</pre></td></tr>
</table>

<p>This is the same XML document as above, but with an external DTD (<a target="_blank" href="note_ex_dtd.xml">Open
it</a>, and select view source):</p>
<table width="100%" border="1" class="ex" cellspacing="0">
  <tr>
    <td>
      <pre>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!DOCTYPE note SYSTEM &quot;note.dtd&quot;&gt;
&lt;note&gt;
&lt;to&gt;Tove&lt;/to&gt;
&lt;from&gt;Jani&lt;/from&gt;
&lt;heading&gt;Reminder&lt;/heading&gt;
&lt;body&gt;Don't forget me this weekend!&lt;/body&gt;
&lt;/note&gt; </pre>
    </td>
  </tr>
</table>
<p>And this is the file &quot;note.dtd&quot; which contains the DTD:</p>
<table width="100%" border="1" class="ex" cellspacing="0">
  <tr>
    <td>
      <pre>&lt;!ELEMENT note (to,from,heading,body)&gt;
&lt;!ELEMENT to (#PCDATA)&gt;
&lt;!ELEMENT from (#PCDATA)&gt;
&lt;!ELEMENT heading (#PCDATA)&gt;
&lt;!ELEMENT body (#PCDATA)&gt;</pre>
    </td>
  </tr>
</table>
<br />
<hr />
<h2>Why Use a DTD?</h2>
<p>With a DTD, each of your XML files can carry a description of its own format.
</p>
<p>With a DTD,
independent groups of people can agree to use a standard DTD for interchanging
data.
</p>
<p>Your application can use a standard DTD to verify that the data you
receive from the outside world is valid.
</p>
<p>You can also use a DTD to verify your own data.
</p>

<hr />

<a href="default.asp"><img alt="back" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="dtd_building.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -