<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="common.xsl"?>
<tutorial>
	<description>Welcome to DTD Tutorials</description>
	<category name="DTD tutorials">
	<group name="Valid XML Document &#38; the DTD"><description><![CDATA[
		So far, we have gone half of the way of XML syntax by reviewed the process of creating a "well-formed" XML document. The other half is to make sure your document is also valid.<p>So, what do we mean by a valid document? Well, a valid document - by definition, is a well-formed XML document and must conform to the specifications defined by a Document Type Definition (DTD). For now, you can think of the DTD as defining the overall structure and syntax of the document. What the DTD does is to specify everything (such as specify grammatical rules) a parser needs to know in order for that parser to translate a well-formed XML document correctly.<p>To specify grammatical rules, the DTDs take advantage of a set of regular expressions that match for specified patterns within the XML document in order to determine whether or not the document is valid. Matching is done conservatively so that anything not specifically allowed by the DTD is forbidden.<p>Okay, enough about what the DTDs' are....let's look at the basic DTD and how you can build them.]]></description>
	</group>
	<group name="The Basic DTD">
		<description><![CDATA[First of all, keep in mind that you can have two type of DTDs, an internal DTD (means embedded in XML document) or an external DTD. Let's us concentrate on the internal DTD for now okay!<p>The simplest usage of a DTD is to add the DTD straight into the prolog portion of your XML document, just after the XML processing instruction. What do we mean by that? let's take a look at the skeleton (not quite valid) below:
		<table border="1" cellpadding="5" width="100%">
          		<tr>
            		<td width="100%"><font color="black" size="1">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;<br>
			      &lt;!DOCTYPE root_element_name [<br>
           			element_definitions_go_here<br>
	      			]&gt;<br>
			        body_goes_here.......</font></td></tr>
        	</table>Here we have declared a root element of the document named ROOT_ELEMENT_NAME. For example, we might use the following syntax for our &quot;contacts&quot; document:<b>contacts</b><b>&quot;</b> 
      		<table border="0" cellpadding="0" cellspacing="0" width="100%">
        		<tr size="1"><td width="99%"><font color="black">For example:</font></td></tr>
      		</table>
        	<table border="0" cellpadding="0" width="99%" cellspacing="0">
          		<tr><td width="99%" colspan="3"><font color="black" size="1">&lt;?xml version = &quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone = &quot;yes&quot;?&gt;</font></td></tr>
          		<tr><td width="99%" colspan="3"><font color="black" size="1"> &lt;!DOCTYPE contacts [</font></td></tr>
          		<tr><td width="99%" colspan="3"><font color="black" size="1">element_definitions_go_here</font></td></tr>
          		<tr><td width="99%" colspan="3"><font color="black" size="1"> ]&gt;</font></td></tr>
          		<tr><td width="99%" colspan="3"><font color="black" size="1">&lt;!-- Body goes here.......Something like the following: --&gt;</font></td></tr>
          		<tr><td width="99%" colspan="3"><font color="black" size="1"> &lt;contacts&gt;</font></td></tr>
          		<tr><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="99%" colspan="2"><font color="black" size="1"> &lt;contact&gt;</font></td></tr>
          		<tr><td width="5%"><font color="black" size="1">&nbsp;</td><td width="5%"><font color="black" size="1">&nbsp;</td><td width="99%"><font color="black" size="1">&lt;name&gt;Ken Warner&lt;/name&gt;</font></td></tr>
          		<tr><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="99%"><font color="black" size="1">&lt;email&gt;ken@yahoo.com &lt;/email&gt;</font></td></tr>
          		<tr><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="99%"><font color="black" size="1"> &lt;phone&gt;2353 8485&lt;/phone&gt;</font></td></tr>
          		<tr><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="99%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
          		<tr><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="99%" colspan="2"><font color="black" size="1"> &lt;contact&gt;</font></td></tr>
          		<tr><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="99%"><font color="black" size="1"> &lt;name&gt;Sam Duncan&lt;/name&gt;</font></td></tr>
          		<tr><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="99%"><font color="black" size="1"> &lt;email&gt;sam@technomusic.org&lt;/email&gt;</font></td></tr>
          		<tr><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="99%"><font color="black" size="1"> &lt;phone&gt;4356 9575&lt;/phone&gt;</font></td></tr>
          		<tr><td width="5%">&nbsp;</td><td width="5%">&nbsp;</td><td width="99%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
          		<tr><td width="99%" colspan="3"><font color="black" size="1"> &lt;/contacts&gt; &lt;!-- End of Body --&gt;</font></td></tr>
        	</table><p>We stated that the above DTD is "not quite valid". Why so? well, the DTD above only tells the parser should expect a document with a root element named "contacts". It does not mention anything about the contents or structure of that document. However, to be valid document, a document's DTD must specify every detail of its structure!<p>To specify the structure, we must populate the "[element_definitions_go_here]" portion of the DTD with a Document Type Definition. Document Type Definitions declare all of the valid document elements using Element Type Declarations (ETDs). 
	]]></description>
	</group>
	<group name="Elements in DTD">
		<description><![CDATA[Element Type Declarations (ETDs) specify the name of elements and whether or not those elements may have any children?. Elements may 
 			have several types of children ranging from none, to plain parsed character 
       		data, to other elements, to other elements with their own children, to any of the above.In general,ETD's follow the generic syntax of:<br><br>
        	<table border="1" cellpadding="0" width="100%">
          		<tr><td width="100%"><font color="black" size="1">&lt;!ELEMENT element_name children_names&gt;</font></td></tr>
        	</table><p>In the case of our &quot;<b>contacts</b>&quot;element we might see something like the following:</font> 
      		<table border="0" cellpadding="0" cellspacing="0" width="100%">
        		<tr><td width="6%"><p></td><td width="94%"><font color="black" size="1">&lt;?xml version = 
            			&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone = &quot;yes&quot;?&gt;<br>
            			&nbsp;&lt;!DOCTYPE contacts [<br>
            			&lt;!ELEMENT contacts ANY&gt;<br>
            			]&gt; </font> </td></tr>
        			<tr><td width="6%"><p> </p></td><td width="94%"><font color="black" size="1">&lt;contacts&gt;<br>&lt;/contacts&gt; </font> </td></tr>
      		</table><p>In this case, the DTD defines an XML document containing a single root element named &quot;<b>contacts</b>&quot; 
        	(don't forget XML is case sensitive) that may contain ANY (case sensitive) 
        	type of child, including parsed character data or other elements.</p>
      		<p>As we have said parenthetically, all elements in an XML document must be defined in the DTD. However, unlike 
        	elements, parsed character data within an &quot;ANY&quot; declaration, 
        	does not need to be defined...thus, the following XML document would be valid:<br></p>
      		<table border="0" cellpadding="0" width="100%" cellspacing="0">
        		<tr><td width="8%"></td><td width="192%" colspan="2"><font color="black" size="1">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;<br>
            			&lt;!DOCTYPE contacts [<br>&lt;!ELEMENT contacts ANY&gt;<br>]&gt;</font></td></tr>
        		<tr><td width="8%"></td><td width="192%" colspan="2"><font color="black" size="1">&lt;contacts&gt;</font></td></tr>
				<tr><td width="8%"></td><td width="10%"></td><td width="182%"><font color="black" size="1">&lt;contact&gt; 
            		Here is some plain parsed character data. &lt;/contact&gt;</font></td></tr>
        		<tr><td width="8%"></td><td width="192%" colspan="2"><font color="black" size="1">&lt;/contacts&gt;</font></td></tr>
      		</table><p>If we want to add in more information such as elements &quot;<b>contact</b>&quot;, &quot;<b>name</b>&quot; and 
        	&quot;<b>email</b>&quot;. You must also define the &lt;contact&gt;, &lt;name&gt; 
        	and &lt;email&gt; elements for the document to be valid or else the parser will return as fatal error . See example below:<br></p>
      		<table border="0" cellpadding="0" cellspacing="0" width="100%">
        		<tr><td width="4%"></td><td width="96%" colspan="3"><font color="black" size="1">&lt;?xml 
            			version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;<br>
            			&lt;!DOCTYPE contacts [<br>
            			&lt;!ELEMENT contacts ANY&gt;<br>
            			&lt;!ELEMENT contact (name)&gt;<br>
            			&lt;!ELEMENT name (#PCDATA)&gt;<br>
            			&lt;!ELEMENT email (#PCDATA)&gt;<br>
            			]&gt;</font></td></tr>
        		<tr><td width="4%"></td><td width="96%" colspan="3"><font color="black" size="1"> &lt;contact&gt;</font></td></tr>
        		<tr><td width="4%"></td><td width="4%"></td><td width="92%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
        		<tr><td width="4%"></td><td width="4%"></td><td width="4%"></td><td width="88%"><font color="black" size="1"> &lt;name&gt;Sam Duncan&lt;/name&gt;<br>&lt;email&gt;sam@technomusic.org&lt;/email&gt;</font></td></tr>
        		<tr><td width="4%"></td><td width="4%"></td><td width="92%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
        		<tr><td width="4%"></td><td width="96%" colspan="3"><font color="black" size="1"> &lt;contacts&gt;</font></td></tr>
      		</table><p>In this case, we have defined an XML document with a single root element named &quot;<b>contacts</b>&quot;. 
			&quot;<b>contacts</b>&quot; may contain parsed character data or child elements (ANY). In particular, &quot;<b>contacts</b>&quot; may contain 
			the child element &quot;<b>contact</b>&quot;, &quot;<b>contact</b>&quot; 
        	contains its own child&nbsp; element named &quot;<b>name</b>&quot; and 
	        &quot;<b>email</b>&quot;, and the elements &quot;<b>name</b>&quot;&nbsp; 
    	    and &quot;<b>email</b>&quot; both contain parsed character data (#PCDATA)!</font></p>
      		<p><img border="0" src="grafix/warn.gif" width="23" height="17">Your 
        	aim is make sure the DTD is conservative as you want it to be. Thus, you 
        	should not use the ANY keyword for any element other than the root element. 
        	Do you know why??? Here is a hint &quot;Think in terms of everything being 
        	denied besides what you specifically allow&quot;.</font></p>
      		<p><img border="0" src="grafix/warn.gif" width="23" height="17">The 
        	double definition of &quot;<b>contact</b>&quot; would cause an error. 
        	Please avoid the following:</font></p>
      		<blockquote> 
        		<p><font size="1">&lt;!ELEMENT contacts ANY&gt;<br>
          			&lt;!ELEMENT contact (name)&gt;<br>
          			&lt;!ELEMENT contact (email)&gt;<br>
          			&lt;!ELEMENT name (#PCDATA)&gt;<br>
          			&lt;!ELEMENT email (#PCDATA)&gt;</font></p>
      		</blockquote>
      		<p>With DTD, you have the power to specify exactly what elements can contain, as shown above. Furthermore, 
        	the DTD allows us to specify very complex logical relationships between 
	        elements and their children by using regular expression pattern matching.
    	    For example, you could specify such things as: an 
        	element may contain a child, one or more children, zero or more children, 
	        or at least one child and so forth. How to do that? let's move on to the 
    	    following topic.
		]]></description>
	<sub-tree1 name="Defining Elements &#38; their Children"><description><![CDATA[Element definitions are described by their Element Content Models (ECM)....that is, all the stuff in the 
        parentheses.Thus, as we saw above, the ECM of the &quot;<b>contact</b>&quot; element specified 
        the child element &quot;<b>name</b>&quot;.
		<blockquote><p><font  size="1">&lt;!ELEMENT contact (name)&gt;</blockquote>
      	<p>The contents of the ECM are governed by a set of regular expression rules very similar to those used in UNIX. 
        But if you are not familiar with UNIX, don't worry, it is pretty easy. 
        The idea of regular expressions is that certain characters are used to 
        communicate matching logic. Take a look at the possible meta characters....</font><br><br>
      	<div align="justify">
        <table border="1" cellpadding="0" width="100%" height="180">
          	<tr valign="top"><td width="18%"><font color="black" size="1"><b>Symbol</b></font></td>
            	<td width="15%"><font color="black" size="1"><b>Meaning</b></font></td><td width="14%"><font color="black" size="1"><b>Example</b></font></td><td width="247%"><font color="black" size="1"><b>Comments</b></font></td></tr>
          	<tr><td width="18%"><font color="black" size="1">+</font></td><td width="15%"><font color="black" size="1">Repetition&nbsp;</font></td><td width="14%"><font color="black" size="1">x+</font></td><td width="247%"><font color="black" size="1">Expected x occurs at least once</font></td></tr>
          	<tr  valign="top"><td width="18%"><font color="black" size="1">* </font></td><td width="15%"><font color="black" size="1">Repetition&nbsp;</font></td><td width="14%"><font color="black" size="1">x*</font></td><td width="247%"><font color="black" size="1">Expected x occurs none or many times</font></td></tr>
	     	<tr><td width="18%"><font color="black" size="1">?</font></td><td width="15%"><font color="black" size="1">Optional</font></td><td width="14%"><font color="black" size="1">x,y?</font></td><td width="247%"><font color="black" size="1">2 elements allowed; x expected, y optional</font></td></tr>
          	<tr  valign="top"><td width="18%"><font color="black" size="1">() </font></td><td width="15%"><font color="black" size="1">Grouping</font></td><td width="14%"><font color="black" size="1">(x, y, z)</font></td><td width="247%"><font color="black" size="1">3 elements expected; x followed by y followed by z (in that order)</font></td></tr>
          	<tr><td width="18%" rowspan="4"><font color="black" size="1">|</font></td><td width="15%" rowspan="4"><font color="black" size="1">Selection such as &quot;this or that&quot; </font></td><td width="14%"><font color="black" size="1">x | y</font></td><td width="247%"><font color="black" size="1">Single element (either x or y expected) but not both</font></td></tr>
          	<tr><td width="14%"><font color="black" size="1">x,(y | z)</font></td><td width="247%"><font color="black" size="1">2 elements allowed; x expected, followed by either y or z</font></td></tr>
          	<tr><td width="14%"><font color="black" size="1">x,(y | z)+</font></td><td width="247%"><font color="black" size="1">At least 2 elements expected. x followed by at least one of y or z (any number of y and z may follow)</font></td></tr>
          	<tr><td width="14%"><font color="black" size="1">x,(y | z)*</font></td><td width="247%"><font color="black" size="1">2 elements allowed; x expected followed by any number of y and z including none</font></td></tr>
          	<tr><td width="18%"><font color="black" size="1">,</font></td><td width="15%"><font color="black" size="1">Strict ordering</font></td><td width="14%"><font color="black" size="1">x, y</font></td><td width="247%"><font color="black" size="1">Expected element x followed by y (in that order)</font></td></tr>
          	<tr><td width="18%"><font color="black" size="1">element_a&nbsp;element_b</font></td><td width="15%"><font color="black" size="1">Unordered</font></td><td width="14%"><font color="black" size="1">x y</font></td><td width="247%"><font color="black" size="1">Expected element x followed by y (or vice versa)</font></td></tr>
        </table>
    </div><p>Let's us go through all the cases by the examples:</p>

	]]>Repeated Elements</description>
	</sub-tree1>
	<sub-tree1 name="Repeated Elements"><description><![CDATA[<b>
    	<p>What do you think the following DTD snippet would imply?
      	<blockquote><p><font size="1">&lt;!ELEMENT contact (name, email+)&gt;<br>
          	&lt;!ELEMENT name (#PCDATA)&gt;<br>
          	&lt;!ELEMENT email (#PCDATA)&gt;</font></p>
      	</blockquote><p>It would mean that a &quot;<b>contact</b>&quot; element could have a &quot;<b>name</b>&quot; element followed by one or more &quot;<b>email</b>&quot; elements. Thus, the following XML would be valid<br></p>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
      		<tr><td width="6%"></td><td width="94%" colspan="2"><font color="black" size="1">&lt;contact&gt;</font></td></tr>
        	<tr><td width="6%"></td><td width="6%"></td><td width="88%"><font color="black" size="1"> &lt;name&gt;Sam Duncan&lt;/name&gt;<br>
            		&lt;email&gt;sam@yahoo.com&lt;/email&gt;<br>
            		&lt;email&gt;sam@hotmail.com&lt;/email&gt;<br>
            		&lt;email&gt;sam@technomusic.org&lt;/email&gt; </font></td></tr>
        	<tr><td width="6%"></td><td width="94%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
      	</table><p>What about the following?<br></p>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="6%"></td><td width="94%" colspan="2"><font color="black" size="1">&lt;contact&gt;</font></td></tr>
        	<tr><td width="6%"></td><td width="6%"></td><td width="88%"><font color="black" size="1"> &lt;name&gt;Sam Duncan&lt;/name&gt;</font></td></tr>
        	<tr><td width="6%"></td><td width="94%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
      	</table><p>Well that would be <b> invalid</b> because in the DTD, we have specified the &quot;+&quot; which is indicated 
        that &quot;<b>email</b>&quot; element must appear &quot;at least one&quot;. 
        To allow for &quot;zero or more&quot; occurrences, you must use a &quot;*&quot; 
        instead, such as:</p>
      	<blockquote><p><font size="1">&lt;!ELEMENT contact (name, email*)&gt;<br>
          	&lt;!ELEMENT name (#PCDATA)&gt;<br>
          	&lt;!ELEMENT email (#PCDATA)&gt;</p>
      	</blockquote>
	]]>Using the &quot;?&quot; character 
        specifies that the element named is optional. Thus, in the following code 
        snippet, we specify that every &quot;contact&quot; must have a 
        &quot;name&quot; and may or may not have an &quot;address&quot;.</description>
	</sub-tree1>
	<sub-tree1 name="Optional Children"><description><![CDATA[<p><b>contact</b><b>name</b><b>address</b></font> 
      	<blockquote><p><font size="1">&lt;!ELEMENT contact (name,&nbsp; address?)&gt;<br>
          	&lt;!ELEMENT name (#PCDATA)&gt;<br>
          	&lt;!ELEMENT address (street+, city, state, zip, country?)<br>
         	&lt;!ELEMENT street (#PCDATA)&gt;<br>
          	&lt;!ELEMENT city (#PCDATA)&gt;<br>
          	&lt;!ELEMENT state (#PCDATA)&gt;<br>
          	&lt;!ELEMENT zip (#PCDATA)&gt;<br>
          	&lt;!ELEMENT country (#PCDATA)&gt;</p>
    	</blockquote>
	]]>Children can be grouped using parentheses. 
        Thus, the following DTD snippet would specify that a &quot;contact&quot; 
        element could have one or more sets of &quot;name/email&quot; children 
        such that &quot;name&quot; always precedes &quot;email&quot;.</description>
	</sub-tree1>
	<sub-tree1 name="Grouping Elements"><description><![CDATA[<p><b>contact</b><b>name/email</b><b>name</b><b>email</b> 
      	<blockquote><p><font size="1">&lt;!ELEMENT contact (name, email)+&gt;<br>
          	&lt;!ELEMENT name (#PCDATA)&gt;<br>
          	&lt;!ELEMENT email (#PCDATA)&gt;</p>
      	</blockquote><p>That would look something like the following:<br></p>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="5%"></td><td width="95%" colspan="2"><font color="black" size="1">&lt;contact&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="5%"></td>
          	<td width="90%"><font color="black" size="1"> &lt;name&gt;Sam Duncan&lt;/name&gt;<br>
            	&lt;email&gt;sam@yahoo.com&lt;/email&gt;<br>
            	&lt;name&gt;Leigh Lee&lt;/name&gt;<br>
            	&lt;email&gt;leigh@yahoo.com&lt;/email&gt;<br>
            	&lt;name&gt;Kim Warner&lt;/name&gt;<br>
            	&lt;email&gt;kim@yahoo.com&lt;/email&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="95%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
     </table>
	]]>OR&quot; operation. Thus, the following 
        DTD snippet would specify an XML document in which all &quot;contact&quot; 
        elements would have a &quot;name&quot; child followed by either 
        a &quot;phone&quot; or an &quot;email&quot; element (but 
        not both).</description>
	</sub-tree1>
	<sub-tree1 name="Either/Or"><description><![CDATA[The pipe &quot;|&quot; character is used to specify an &quot;<b><b>contact</b><b>name</b><b>phone</b><b>email</b></font> 
      	<blockquote><p><font size="1">&lt;!ELEMENT contact (name, (phone | email))&gt;<br>
          	&lt;!ELEMENT name (#PCDATA)&gt;<br>
          	&lt;!ELEMENT email (#PCDATA)&gt;</font></p>
      	</blockquote><p>Note that XML regular expression matching is not a short circuited system. OR's imply one or the other 
        but not both and not neither. Here are several <b> invalid </b> XML snippets 
        based on the DTD snippet above....<br></p>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%" height="64">
        	<tr><td width="5%" height="22"><font color="black" size="1"><img border="0" src="grafix/warn.gif" width="23" height="17"></font></td><td width="95%" colspan="2"><font color="black" size="1">&lt;contact&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="6%"></td><td width="89%"><font color="black" size="1"> &lt;name&gt;Sam Duncan&lt;/name&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="95%" colspan="2"><font color="black" size="1">&lt;/contact&gt;</font></td></tr>
      	</table><p>That is <b> invalid</b> because the DTD specified that every &quot;<b>contact</b>&quot; must have either 
        a &quot;<b>phone</b>&quot; or an &quot;<b>name</b>&quot;. The above has neither.<br></p>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="5%"><font color="black" size="1"><img border="0" src="grafix/warn.gif" width="23" height="17"></font></td><td width="95%" colspan="2"><font color="black" size="1">&lt;contact&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="7%"></td><td width="88%"><font color="black" size="1"> &lt;name&gt;Sam Duncan&lt;/name&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="7%"></td><td width="88%"><font color="black" size="1"> &lt;email&gt;sam@technomusic.org&lt;/email&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="7%"></td><td width="88%"><font color="black" size="1"> &lt;phone&gt;4356 9575&lt;/phone&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="95%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
      	</table><p> This one is <b> invalid</b> because the contact has BOTH &quot;<b>email</b>&quot; and &quot;<b>phone</b>&quot; children.</font></p>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="5%"><font color="black" size="1"><img border="0" src="grafix/warn.gif" width="23" height="17"></font></td><td width="95%" colspan="2"><font color="black" size="1">&lt;contact&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="4%"></td><td width="91%"><font color="black" size="1"> &lt;email&gt;sam@technomusic.org&lt;/email&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="4%"></td><td width="91%"><font color="black" size="1"> &lt;name&gt;Sam Duncan&lt;/name&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="95%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
      	</table><p>This one is wrong because &quot;<b>name</b>&quot; must appear before &quot;<b>email</b>&quot; or &quot;<b>phone</b>&quot;</font></p><p><b>Note:</b> within a grouping, 
        you may use only one connector (such as , or |). Thus, it is <b> invalid</b> to use:<br><br></font>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="5%"><font color="black" size="1"><img border="0" src="grafix/warn.gif" width="23" height="17"></font></td><td width="95%"><font color="black" size="1">&lt;!ELEMENT contact (name, phone | email)&gt;</font></td></tr>
      	</table><p>Instead, you must create a subgroup as shown below</p>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="5%"></td><td width="95%"><font color="black" size="1">&lt;!ELEMENT contact (name, (phone | email))&gt;</font></td></tr>
      	</table>
	]]></description>
	</sub-tree1>
	<sub-tree1 name="Ordering Child Elements"><description><![CDATA[Consider the following DTD snippet....<br><br>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="5%"></td><td width="95%"><font color="black" size="1">&lt;!ELEMENT contact (name email)&gt;<br>
      				&lt;!ELEMENT name (#PCDATA)&gt;<br>
      				&lt;!ELEMENT email (#PCDATA)&gt;</font></td></tr>
      	</table><p>In this case, we expect to see XML along the lines of<br></p>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="5%"></td><td width="95%" colspan="2"><font color="black" size="1">&lt;contact&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="4%"></td><td width="91%"><font color="black" size="1"> &lt;name&gt;Sam Duncan&lt;/name&gt;<br>&lt;email&gt;sam@technomusic.org&lt;/email&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="95%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
      	</table><p>Alternatively, the following code would be valid:<br></p>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="5%"></td><td width="95%" colspan="2"><font color="black" size="1">&lt;contact&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="4%"></td><td width="91%"><font color="black" size="1"> &lt;email&gt;sam@technomusic.org&lt;/email&gt;<br>&lt;name&gt;Sam Duncan&lt;/name&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="95%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
      	</table><p>Notice that since we simply listed the children of &quot;<b>contact</b>&quot; as a space delimited list, we do 
        not specify any order in which the children should appear. If we wish to have the elements appear in order, we must use a comma to separate the list. Like the folllowing:<br></p>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="5%"></td><td width="95%"><font color="black" size="1">&lt;!ELEMENT contact (name, email)&gt;<br>
      				&lt;!ELEMENT name (#PCDATA)&gt;<br>
      				&lt;!ELEMENT email (#PCDATA)&gt;</font></td></tr>
      	</table><p>Then the following XML would be valid
      	<table border="0" cellpadding="0" cellspacing="0" width="100%" height="76" class="td">
        	<tr><td width="6%" ></td><td width="94%" colspan="2"><font color="black" size="1">&lt;contact&gt; </font></td></tr>
        	<tr><td width="1%"></td><td width="5%"></td><td width="99%"><font color="black" size="1"> &lt;name&gt;Sam Duncan&lt;/name&gt;<br>&lt;email&gt;sam@technomusic.org&lt;/email&gt; </font></td></tr>
        	<tr><td width="1%"><p></p></td><td width="99%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
      	</table><p>But the following XML would be <b> invalid</b> because the &quot;<b>email</b>&quot; element would not be allowed to precede the &quot;<b>name</b>&quot; element.<br><br>    
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="5%"><font color="black" size="1"><img border="0" src="grafix/warn.gif" width="23" height="17"></font></td><td width="95%" colspan="2"><font color="black" size="1">&lt;contact&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="5%"></td><td width="90%"><font color="black" size="1"> &lt;email&gt;sam@technomusic.org&lt;/email&gt;<br>&lt;name&gt;Sam Duncan&lt;/name&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="95%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
      	</table>
    ]]></description>
	</sub-tree1>
	<sub-tree1 name="Mixed Content"><description><![CDATA[In certain, probably rare circumstances, you will wish to include parsed character data as a valid element. Mixing content works as expected. Thus, the following XML document would be valid.<br><br>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="5%"></td>	<td width="95%" colspan="3"><font color="black" size="1">&lt;?xml 
            		version = &quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone = 
            		&quot;yes&quot;?&gt;<br>
            		&lt;!DOCTYPE contacts [<br>
            		&lt;!ELEMENT contacts ANY&gt;<br>
            		&lt;!ELEMENT contact (name | email | phone | #PCDATA)*&gt;<br>
            		&lt;!ELEMENT name (#PCDATA)&gt;<br>
            		&lt;!ELEMENT email (#PCDATA)&gt;<br>
            		&lt;!ELEMENT phone (#PCDATA)&gt;<br>
            		]&gt;<br>
            		&lt;contacts&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="5%"></td><td width="90%" colspan="2"><font color="black" size="1"> &lt;contact&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="5%"></td><td width="4%"></td><td width="86%"><font color="black" size="1"> &lt;name&gt;Sam Duncan&lt;/name&gt;<br>
            		&lt;email&gt;sam@technomusic.org&lt;/email&gt;<br>
            		&lt;phone&gt;2648 4848 XYZ&lt;/phone&gt;<br>
            		Blah blah blah</font></td></tr>
        	<tr><td width="5%"></td><td width="5%"></td><td width="90%" colspan="2"><font color="black" size="1"> &lt;/contact&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="95%" colspan="3"><font color="black" size="1"> &lt;/contacts&gt;</font></td></tr>
      	</table>
	]]>&lt;!ELEMENT hr EMPTY&gt;</description>
	</sub-tree1>
	<sub-tree1 name="Empty Elements"><description><![CDATA[Empty elements are used when we 
        need the element name to act as a placeholder in the document structure 
        but we do not want the XML parser to interpret the content itself. The 
        syntax for defining an empty tag is pretty much simple, you simply use 
        the EMPTY keyword such as:<p><font size="1">&lt;!ELEMENT hr EMPTY&gt;</font><p>
        Then in your XML code, you should have an element &lt;hr/&gt;</p><p>&nbsp;</p>
	]]></description>
	</sub-tree1>
</group>
<group name="Attributes in DTD"><description><![CDATA[In a DTD, attributes are declared with an ATTLIST declaration.Here is the general format of declaring the attributes in the DTD:<br><br>
   	<table border="1" cellpadding="0" width="95%">
    	<tr><td><font color="black" face="Tahoma" size="1">&lt;!ATTLIST element_name attribute_name attribute_type default_value&gt;&nbsp;</font></td></tr>
     </table><p><font  size="1">DTD example: &lt;!ATTLIST payment type CDATA &quot;check&quot;&gt;</font><p><font size="2">XML example: &lt;payment type=&quot;check&quot;&gt;<br></font><br><b>Explanation</b>
     <table border="1" cellpadding="0" width="95%">
        <tr><td width="13%"><font color="black" size="1">element_name</font></td><td width="80%" valign="top"><font color="black" size="1">The element in which the attribute appears such as &quot;<b>payment</b>&quot;</font></td></tr>
        <tr><td width="13%" valign="top"><font color="black" size="1">attribute_name</font> </td><td width="80%" valign="top"><font color="black" size="1">The name of the attribute such as &quot;<b>type</b>&quot;</font></td></tr>
        <tr><td width="13%" valign="top"><font color="black" size="1">attribute_type</font> </td><td width="80%" valign="top"><font color="black" size="1">The attribute type in this case is &quot;<b>CDATA</b>&quot; which means Character Data</font></td></tr>
        <tr><td width="13%" valign="top"><font color="black" size="1">default_value</font></td><td width="80%" valign="top"><font color="black" size="1">Value is &quot;<b>check</b>&quot;. If there is no value is specified by the document author, the default value is used. There are several keywords that define standard defaults....</font></td></tr>
 	</table><p><b><font size="2">Note:</font></b>Since <b> ATTLIST</b> is a list it can have repeated attribute parts (and often does).&nbsp;Consider the following example:<br><br></font>
    <table border="0" cellpadding="0" cellspacing="0" width="95%">
        <tr><td width="4%"></td><td width="90%" colspan="4" valign="top"><font color="black" size="1">&lt;!ELEMENT my_car EMPTY&gt;</font></td></tr>
        <tr><td width="4%"></td><td width="90%" colspan="4" valign="top"><font color="black" size="1">&lt;!ATTLIST my_car</font></td></tr>
        <tr><td width="4%"></td><td width="10%"></td><td width="14%" valign="top"><font color="black" size="1">is_red</font></td><td width="11%" valign="top"><font color="black" size="1">(yes&nbsp;|&nbsp;no)</font></td><td width="60%" valign="top"><font color="black" size="1">&quot;yes&quot;</font></td></tr>
        <tr><td width="4%"></td><td width="10%"></td><td width="14%" valign="top"><font color="black" size="1">brand_name</font></td><td width="11%" valign="top"><font color="black" size="1">ID</font></td><td width="60%" valign="top"><font color="black" size="1">#REQUIRED</font></td></tr>
        <tr><td width="4%"></td><td width="10%"></td><td width="14%" valign="top"><font color="black" size="1">description</font></td><td width="11%" valign="top"><font color="black" size="1">CDATA</font></td><td width="60%" valign="top"><font color="black" size="1">#IMPLIED&gt;</font></td></tr>
  	</table><p>As you can see, each attribute has 3 components: a name (eg. is_blue), which follows the same rules as element names do; the type of information to be passed; and how default values are to be handled.
	]]></description>
	<sub-tree1 name="Attribute Types"><description><![CDATA[Aside from the defaults, the <b>attribute_type </b>can have the following values:</font> 
        <li>CDATA</li>
		<li>Enumerated</li>
       	<li>ID</li> 
        <li>IDREF</li>
        <li>IDREFS</li>
        <li>ENTITY</li>
        <li>ENTITIES</li>
        <li>NMTOKEN</li>
        <li>\NMTOKENS</li>
        <li>NOTATION</li>
        <li>xml: (This value is a predefinged xml value).</li> 
      	<p>Let's take a look at each....</font></p>
	]]></description>
	</sub-tree1>
	<sub-tree1 name="CDATA Type"><description><![CDATA[CDATA refers to plain old character 
        data that may be any string of characters that does not include ampersands 
        (&amp;), less than signs, (&lt;), or quotation marks (&quot;). Of course, 
        as we discussed earlier, you may use the escaped characters such as &amp;, 
        &lt;, or &quot; if you must include those forbidden characters.<br><br>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="4%"></td><td width="96%" colspan="2" valign="top"><font color="black" size="1">&lt;?xml 
            		version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;<br>
            		&lt;!DOCTYPE script [<br>
            		&lt;!ELEMENT script ANY&gt;<br>
            		&lt;!ELEMENT dialog (#PCDATA)&gt;<br>
            		&lt;!ATTLIST dialog actor CDATA&gt;<br>
            		]&gt;<br>
            		&lt;script&gt;</font> </td></tr>
        	<tr><td width="4%"></td><td width="4%"></td><td width="92%" valign="top"><font color="black" size="1"> &lt;dialog actor=&quot;Hanks&quot;&gt;I don't think so!&lt;/dialog&gt;<br>&lt;dialog actor=&quot;Ryan&quot;&gt;Why not?&lt;/dialog&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="96%" colspan="2" valign="top"><font color="black" size="1">&lt;/script&gt;</font> </td></tr>
      	</table>
	]]>A list of acceptable pipe &quot;|&quot; delimited values from which the document author must choose.</description>
	</sub-tree1>
	<sub-tree1 name="Enumerated"><description><![CDATA[<p><b>|</b> <br> <br>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="4%"></td><td width="96%" colspan="2" valign="top"><font color="black" size="1">&lt;?xml 
            		version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;<br>
           			&lt;!DOCTYPE grocery_basket [<br>
            		&lt;!ELEMENT grocery_basket ANY&gt;<br>
            		&lt;!ELEMENT meat EMPTY&gt;<br>
            		&lt;!ATTLIST meat (chicken |&nbsp;beef |&nbsp;pork |&nbsp;fish) &quot;chicken&quot;&gt;<br>
            		]&gt;<br>
            		&lt;grocery_basket&gt; </font></td></tr>
        		<tr><td width="4%"></td><td width="4%"></td><td width="92%" valign="top"\><font color="black" size="1"> &lt;meat TYPE=&quot;fish&quot;/&gt;<br>
            			&lt;meat TYPE=&quot;beef&quot;/&gt;<br>
            			&lt;meat/&gt; </font></td></tr>
        		<tr><td width="4%"></td><td width="96%" colspan="2" valign="top"><font color="black" size="1">&lt;/grocery_basket&gt;</font></td></tr>
      		</table><p><b>Note</b> that in the example above, if no TYPE is specified the default value &quot;<b>chicken</b>&quot; is assumed.</p>      
	]]>ID in XML is very handy especially when you start dealing with valid documents.</description>
	</sub-tree1>
	<sub-tree1 name="ID &#38; IDREF"><description><![CDATA[<p>
          <ul>
      	<li>ID represents a unique ID name for the attribute that identifies the element within the context of the document.&nbsp;</li>
        <li>IDs are much like internal links in plain HTML.&nbsp;</li>
        <li>For the most part, ID is used primarily by programs or scripting languages that process the document.&nbsp;</li>
      	<p><img border="0" src="grafix/warn.gif" width="27" height="20"> The value for ID must be a valid XML name beginning with a letter and containing alphanumeric
      	characters or the underscore character without any whitespace.</font></p>
      	<img border="0" src="grafix/warn.gif" width="27" height="20">ID is incompatible with the #FIXED
        keyword but usually appears in conjunction with the #REQUIRED
        keyword (we'll discuss these later). Of course, while ID is
        usually #REQUIRED, the reverse is definitely not true.
        <p><img border="0" src="grafix/warn.gif" width="27" height="20">Also, take care that your ID values are unique within a document!</p>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="4%"></td><td width="96%" colspan="3" valign="top"><font color="black" size="1">&lt;?xml 
            		version=&quot;1.0&quot;&nbsp;encoding=&quot;UTF-8&quot;&nbsp;standalone=&quot;yes&quot;?&gt;<br>
            	&lt;!DOCTYPE contacts [<br>
            	&lt;!ELEMENT contacts ANY&gt;<br>
            	&lt;!ELEMENT contact (name, email)&gt;<br>
            	&lt;!ELEMENT name (#PCDATA)&gt;<br>
            	&lt;!ELEMENT email (#PCDATA)&gt;<br>
            	&lt;!ATTLIST contact contact_num ID #REQUIRED&gt;<br>
            	]&gt;<br>
            	&lt;contacts&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="5%"></td><td width="91%" colspan="2" valign="top"><font color="black" size="1">&lt;contact contact_num=&quot;1&quot;&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="5%"></td><td width="4%"></td><td width="87%" valign="top"><font color="black" size="1"> &lt;name&gt;Sam Duncan&lt;/name&gt;<br>&lt;email&gt;sam@technomusic.org&lt;/email&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="5%""></td><td width="91%" colspan="2" valign="top"><font color="black" size="1">&lt;/contact&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="5%"></td><td width="91%" colspan="2" valign="top"><font color="black" size="1">&lt;contact contact_num=&quot;2&quot;&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="5%"></td><td width="4%"></td><td width="87%" valign="top"><font color="black" size="1"> &lt;name&gt;John Smith&lt;/name&gt;<br>&lt;email&gt;john01@technomusic.org&lt;/email&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="5%"></td><td width="91%" colspan="2" valign="top"><font color="black" size="1">&lt;/contact&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="96%" colspan="3" valign="top"><font color="black" size="1">&lt;/contacts&gt;</font></td></tr>
      	</table><p>The IDREF type allows the value of one attribute to be an element elsewhere in the document provided that the value of the IDREF is the ID value of the referenced element.</font>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="4%"></td><td width="96%" colspan="3" valign="top"><font color="black" size="1">&lt;?xml 
            	version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;<br>
            	&lt;!DOCTYPE contacts [<br>
            	&lt;!ELEMENT contacts ANY&gt;<br>
            	&lt;!ELEMENT contact (name, email)&gt;<br>
            	&lt;!ELEMENT name (#PCDATA)&gt;<br>
            	&lt;!ELEMENT email (#PCDATA)&gt;<br>
            	&lt;!ATTLIST contact contact_num ID #REQUIRED&gt;<br>
            	&lt;!ATTLIST contact mother IDREF #IMPLIED&gt;<br>
            	]&gt;<br>
            	&lt;contacts&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="4%"></td><td width="92%" colspan="2" valign="top"><font color="black" size="1">&lt;contact contact_num=&quot;2&quot;&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="4%"></td><td width="4%"></td><td width="88%" valign="top"><font color="black" size="1"> &lt;name&gt;George Pye&lt;/name&gt;<br>&lt;email&gt;george@technomusic.org&lt;/email&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="4%"></td><td width="92%" colspan="2" valign="top"><font color="black" size="1">&lt;/contact&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="4%"></td><td width="92%" colspan="2" valign="top"><font color="black" size="1">&lt;contact contact_num=&quot;1&quot; mother=&quot;2&quot;&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="4%"></td><td width="4%"></td><td width="88%" valign="top"><font color="black" size="1"> &lt;name&gt;Nina Pye&lt;/name&gt;<br>&lt;email&gt;nina@technomusic.org&lt;/email&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="4%"></td><td width="92%" colspan="2" valign="top"><font color="black" size="1">&lt;/contact&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="96%" colspan="3" valign="top"><font color="black" size="1">&lt;/contacts&gt;</font></td></tr>
      	</table>
	]]></description>
	</sub-tree1>
	<sub-tree1 name="ENTITY &#38; ENTITIES"><description><![CDATA[<p>Remember we have talked about entities in XML
      	tutorials? Really, the only way to include unparsed entities as part of
      	the document is through the use of ENTITY type attributes for some
      	elements. Let's us try to show you through example:<br>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
      		<tr><td width="4%"></td><td width="96%" valign="top"><font color="black" size="1">&lt;!ELEMENT illustration (#PCDATA)&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="96%" valign="top"><font color="black" size="1">&lt;!ATTLIST illustration external.artwork ENTITY #IMPLIED&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="96%" valign="top"><font color="black" size="1">&lt;!ENTITY sun.logo SYSTEM &quot;XML in Action: Chapter 2: entity example&quot; NDATA gif&gt;</font></td></tr>
        	<tr><td width="4%"></td><td width="96%" valign="top"><font color="black" size="1">&lt;illustration external.artwork=&quot;sun.logo&quot;&gt;&lt;/illustration&gt;</font></td></tr>
      	</table><p><b>Note: </b>Entities with an NDATA term are unparsed external entities which means that the data contained within
      	these entities may or may not be text. If it is text - this may or may not be XML code. In any case, the parser skips over the details of the
      	contents of such entities. So, there are no constraints upon the type of data that an unparsed entity may contain.</p>
      	<p>We can name a single entity by declaring the attribute as type ENTITY in the ATTLIST declaration for the element
      	concerned. It is possible to declare the attribute to accept multiple entities by using the type ENTITIES, which works in the same way as the
      	IDREFS type in the section above.</p>
	]]></description>
	</sub-tree1>
	<sub-tree1 name="NMTOKEN &#38; NMTOKENS"><description><![CDATA[<p>Often we do not need attributes that are treated
    as character data, refer to other locations within the document and so forth. However, we do want a name value such that might be used for the
    security level of the document or a language name or code. In XML, we can declare an attribute to be a NMTOKEN. Such as a Java class or a security algorithm. For example:<br><br>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="4%"></td><td width="96%" colspan="2" valign="top"><font color="black" size="1">&lt;!ATTLIST data authorised_users NMTOKENS #IMPLIED&gt; </font></td></tr>
        	<tr><td width="4%"></td><td width="4%"></td><td width="92%" valign="top"><font color="black" size="1"> &lt;data security=&quot;ON&quot; authorised_users=&quot;johN pauL Young&quot;&gt;<br>blah blah blah... </font></td></tr>
        	<tr><td width="4%"></td><td width="96%" colspan="2" valign="top"><font color="black" size="1">&lt;/data&gt; </font></td></tr>
      	</table><p><img border="0" src="grafix/warn.gif" width="27" height="20">We
      	may need&nbsp; to include several name values with an attribute. If we
      	tried to do that with a NMTOKEN attribute we would get an error. If that's
      	the case, try to use NMTOKENS attribute instead. Since NMTOKENS allows us
      	to include more than one value, of course we can still provide a single value there if we wish.</p>    
	]]></description>
	</sub-tree1>
	<sub-tree1 name="NOTATION Type"><description><![CDATA[<p>This type allows an attribute to have a value specified by a notation
    declared in the DTD in cases which you want certain consequences to
    follow from the attribute. these are usually used as triggers such as when
    you want to specify a given player for a given file type.
     	<table border="0" cellpadding="0" cellspacing="0" width="100%">
        	<tr><td width="5%"></td><td width="95%" colspan="2" valign="top"><font color="black" size="1">&lt;?xml 
            	version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;<br>
            	&lt;!DOCTYPE document [<br>
            	&lt;!ELEMENT document ANY&gt;<br>
            	&lt;!ELEMENT movies EMPTY&gt;<br>
            	&lt;!ATTLIST movie source ENTITY #REQUIRED&gt;<br>
            	&lt;!ATTLIST movie player NOTATION #REQUIRED&gt;<br>
            	&lt;!ENTITY BladeRunner SYSTEM &quot;dvds/BR/br.mov&quot;&gt;<br>
            	&lt;!NOTATION mp SYSTEM &quot;movPlayer.exe&quot;&gt;<br>
            	]&gt;<br>
            	&lt;document&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="5%"></td><td width="90%" valign="top"><font color="black" size="1"> &lt;movie source=&quot;&amp;BladeRunner;&quot; player=&quot;mp&quot;/&gt;</font></td></tr>
        	<tr><td width="5%"></td><td width="95%" colspan="2" valign="top"><font color="black" size="1">&lt;/document&gt;</font></td></tr>
      	</table>
	]]></description>
	</sub-tree1>	
</group>
	<sub-tree1 name="Default values of attributes"><description><![CDATA[<p>The default_value can have the following values:&nbsp;<br><br>
      	<table border="1" width="100%" cellpadding="0"><tbody class="td"> 
        	<tr><th align="left" width="114" valign="top"><font color="black" size="2">Value</font></th>
          		<th align="left" width="628" valign="top"><font color="black" size="2">Explanation</font></th></tr>
        	<tr><td valign="top" width="114" size="1"><p><font color="black" size="1">value</font></p></td><td valign="top" width="628" size="1"><p><font color="black" size="1">The attributes default value</font></p></td></tr>
        	<tr><td valign="top" width="114"><p><font color="black" size="1">#DEFAULT&nbsp;value</font></p></td><td valign="top" width="628"><p><font color="black" size="1">Specifying a default value for an attribute, assures that the attribute will get a value even if the author of the XML document didn't include it. </font></p>
            <table border="1" cellpadding="0" width="100%">
              	<tr><td width="100%"><font color="black" size="1"><b>Syntax:</b>&nbsp; &lt;!ATTLIST element-name attribute-name attribute-type &quot;default-value&quot;&gt;</font></td></tr>
            </table><font size="1"><b><font color="black">DTD&nbsp;example:</font>&nbsp;</b> 
            <font color="black" size="1">&lt;!ATTLIST payment type CDATA &quot;check&quot;&gt;<br>
            <b>XML&nbsp;example: </b>&lt;payment type=&quot;check&quot;&gt;<br>&nbsp;</font></font> </td></tr>
        	<tr><td valign="top" width="114"><p><font color="black" face="Tahoma" size="1">#REQUIRED</font></p></td><td valign="top" width="628"><p><font color="black" size="1">The attribute value 
              	must be included in the element. Use a required attribute if you 
              	don't have an option for a default value, but still want to force 
              	the attribute to be present.</font></p>
            <table border="1" cellpadding="0" width="100%">
              	<tr><td bgcolor="#FFFFFF"><p><font color="black" size="1"><b>Syntax:</b></font>&nbsp; <font color="black">&lt;!ATTLIST element-name attribute_name attribute-type #REQUIRED&gt;</font></p></td></tr>
            </table><font color="black" size="1"><b>DTD&nbsp;example:&nbsp;</b> 
            &lt;!ATTLIST person number CDATA #REQUIRED&gt;<br>
            <b>XML&nbsp;example:</b> &lt;person number=&quot;5677&quot;&gt;<br>&nbsp;</font> </td></tr>
        	<tr><td valign="top" width="114"><p><font color="black" size="1">#IMPLIED</font></p></td><td valign="top" width="628"><p><font color="black" size="1">The attribute does 
              	not have to be included. Use an implied attribute if you don't want to force the author to include an attribute, and you don't have an option for a default value.&nbsp;<br></font></p>
            	<table border="1" cellpadding="0" width="100%" bordercolor="#CCCCFF" bgcolor="#D2F4FF">
              		<tr><td><font color="black" size="1"><b>Syntax:</b> &lt;!ATTLIST element-name attribute-name attribute-type #IMPLIED&gt;</font></td></tr>
            	</table><font color="black" size="1"><b>DTD&nbsp;example:&nbsp;</b>&lt;!ATTLIST contact fax CDATA #IMPLIED&gt;<br>
            	<b>XML&nbsp;example:</b> &lt;contact fax=&quot;555-667788&quot;&gt;<br>&nbsp;</font> </td></tr>
        	<tr><td valign="top" width="114"><p><font color="black" size="1">#FIXED&nbsp;value</font></p></td><td valign="top" width="628"><p><font color="black" size="1">Use a fixed attribute 
              	value when you want an attribute to have a fixed value without allowing 
              	the author to change it. If an author includes another value, the 
              	XML parser will return an error.<br></font></p>
            <table border="1" cellpadding="0" width="100%">
              	<tr><td><p><font color="black" size="1"><b>Syntax:</b> &lt;!ATTLIST element-name attribute-name attribute-type #FIXED &quot;value&quot;&gt;</font></p></td></tr>
            </table><font color="black" size="1"><b>DTD&nbsp;example:</b>&nbsp;&lt;!ATTLIST sender company CDATA #FIXED &quot;Microsoft&quot;&gt;<br>
            <b>XML&nbsp;example:</b> &lt;sender company=&quot;Microsoft&quot;&gt;<br>&nbsp;</font> </td></tr></tbody> 
      </table>
	]]></description>
	</sub-tree1>
<group name="Entities in DTD">
	<description><![CDATA[<p>
		We have discussed quite extensively upon 
        the concept of entities in <a href="/xml/xmlintro.xml" target="_blank" style="color: black">XML 
        tutorials</a>. If we recall, both general and parameter entities were 
        used like macros or aliases in XML. The purpose is to save time and effort 
        of retyping the same text over and over again. Also, it is extremely useful 
        when it comes to modifications to data, it needs only happen in one centralised 
        locale to implement global changes.<p></p>
	]]></description>
	<sub-tree1 name="General Entities"><description><![CDATA[<p>General entities allow you to create 
      document-wide entities and look something like:<br><br>
      <table border="1" cellpadding="0" width="100%">
        <tr><td><p><font color="black" size="1">&lt;!ENTITY &amp; name &quot;text that you want to be represented by the entity&quot;&gt; </font></p></td></tr>
      </table><p>In the real world, you might have something that looked like the following:
      <p><font  size="1">&lt;!ENTITY &amp; copyright_text &quot;Copyright © 2000-2001 Vovisoft, all rights reserved&quot;&gt;</font></p>
      <p>Entities are referenced using a &amp;entity_name;&nbsp;&nbsp;such as:</p>
      <p><font size="1">&lt;!ENTITY &amp; tag_names &quot;name | email | phone | address&quot;&gt;<br>&lt;!ELEMENT business_contact (&amp;tag_names; | company_name)&gt;</p>
      <p><img border="0" src="grafix/dtdent1.gif" width="27" height="20">Make sure you remember the semi-colon at the end of tag_names.</p>
      <p><b>Note:</b> If you wish to specify an entity that has text defined external to the document, simply use the SYSTEM keyword, such as: 
      <p><fontsize="1">&lt;!ENTITY &amp; license_agreement&nbsp;SYSTEM &quot;http://www.mydomain.com/license.xml&quot;&gt;</font></p>
      <p>In this case, the XML processor will replace the entity reference with the contents of the document specified.</font></p>
      <p><font size="1"><img border="0" src="grafix/dtdent1.gif" width="27" height="20">Remember to define them (entities) first before using them. Thus, the following would be invalid because the <b>tag_names</b> alias is defined after it is used.</font>
      <p><font size="1">&lt;!ELEMENT personal_contact (%tag_names; | birthday)&gt;<br> &lt;!ELEMENT business_contact (%tag_names; | company_name)&gt;<br>&lt;!ENTITY &amp;tag_names &quot;name | email | phone | address&quot;&gt;</font></p><p></p>
	]]></description>
	</sub-tree1>
	<sub-tree1 name="Parameter Entities"><description><![CDATA[<p>Parameter entities, that can be either internal or external, are only used within the DTD and look something like the following:<br><br>
      <table border="1" cellpadding="0" width="100%">
        <tr><td><p><font color="black" size="1">&lt;!ENTITY % alias &quot;text to be aliased&quot;&gt; </font></p></td></tr>
      </table><p>For example, you might have something like....
      <p><font size="1">&lt;!ENTITY % name &quot;text that you want to be represented&quot;&gt;</font></p>
      <p>Using Parameter entities, you can shorted the declarations of other elements and attributes such as:</p>
      <p><font size="1">&lt;!ENTITY % tag_names &quot;name | email | phone | address&quot;&gt;<br>
        &lt;!ELEMENT personal_contact (%tag_names; | birthday)&gt;<br>
        &lt;!ELEMENT business_contact (%tag_names; | company_name)&gt;</font></p>
      <p><img border="0" src="grafix/dtdent1.gif" width="27" height="20">Parameter Entity declarations must precede any reference to them and must be properly nested.</p>
	]]></description>
	</sub-tree1>
</group>
<group name="DTD Types"><description>There are two type of DTDs<![CDATA[<p><li>Internal DTD</li><li>External DTD</li><p><b>Internal DTD</b><br>Here is an example of declaring internal DTD:<p><font size="1">&lt;!DOCTYPE Catalog [ ...internal subset declarations here... ]&gt;</font><p>Internal DTDs are very useful such as for simple vocabularies - particularly when testing prototypes of markup.<p><b>External DTDs</b><br>Here is an example of external DTD:<p><font size="1">&lt;!DOCTYPE Catalog SYSTEM "http://vovisoft/dtd/sample.dtd&quot;&gt;</font><p>External are more flexible in certain respects. However, in some cases, authors might wish to use both an internal DTD and an external DTD. An internal DTD uses to add declarations. When an internal DTD declares some item that was also declared in the exernal DTD, the internal declaration supersedes the external declaration. Thus, care must be taken when using both internal and external DTDs<p>]]></description>
	<sub-tree1 name="Internal vs External DTDs"><description><![CDATA[<p>Throughout this tutorial, we have already alluded to several times on DTD. For simplicity, a DTD can either 
        be included as part of well-formed XML document (where we have standard=&quot;yes&quot;) 
        or it can be referenced from an external source (standalone=&quot;no&quot;).
      <p><img border="0" src="grafix/dtddtd1.gif" width="27" height="20">In 
        order to reference an external DTD, both the XML and the DOCTYPE declarations 
        are must change accordingly.<p><b>1.</b> The XML Declaration must be changed to reflect the fact that the XML document will not work on its own. That is, it will not be standalone.<br><br>
    <table border="1" cellpadding="0" width="100%" cellspacing="1">
      <tr><td width="100%" colspan="2" height="17"><font color="black" size="1">&lt;?xml 
            version = &quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone = 
            &quot;no&quot;?&gt;</font></td></tr>
    </table><p><b>2.</b>You will also need to change the DOCTYPE declaration to add the SYSTEM attribute.<br> </p>
    <table border="1" cellpadding="0" width="100%">
      <tr><td width="100%"><font color="black" size="1">&lt;!DOCTYPE root_element SYSTEM &quot;URL_of_external_dtd&quot;&gt;</font></td></tr>
    </table>
      <p>Such as....</p><p><font size="1">&lt;!DOCTYPE contacts SYSTEM &quot;http://www.mydomain.com/dtds/contacts.dtd&quot;&gt;</font></p>
      <p>We can also have the URL may be a relative or absolute file location. For examples:</p>
      <p><b>a.</b> Specifies a dtd file in the same directory as the XML document that references it.</font></p>
      <p><font size="1">&lt;!DOCTYPE contacts SYSTEM &quot;contacts.dtd&quot;&gt;</font></p>
      <p><b>b.</b> We can reference the same document up one directory and down one into the &quot;dtds&quot; directory. Like the following</font></p>
      <p><font size="1">&lt;!DOCTYPE contacts SYSTEM &quot;../dtds/contacts.dtd&quot;&gt;</font></p>
      <p>Using this method, you can simply cut out the DTD part from your XML document and save it into the separate document called contacts.dtd. Therefore, you have one file with the DTD and one file with the well-formed XML document.</p>
      <p><b>Note:</b> The SYSTEM keyword does more than simply reference to an external DTD, it's primarily used 
        for referencing private DTDs that are shared among the documents of a single author or organization.</p><p>&nbsp;</p>
	]]></description>
	</sub-tree1>
	<sub-tree1 name="Advantages of using external DTDs"><description><![CDATA[
		<table border="0" cellpadding="0" cellspacing="0" width="100%">
      		<li><font color="black">Easily and efficiently be shared by more than one XML document, you can write a DTD once and have multiple documents reference to it.</font></li>
      		<li><font color="black">Only need to change one&nbsp; to the central DTD, all documents that rely on the DTD are updated in one fell swoop.</font></li>
      		<li><font color="black">Save typing time.</font></li>
	]]></description>
	</sub-tree1>
	<sub-tree1 name="Public DTDs"><description><![CDATA[<p>As we have discovered above, we could have DTDs as private. However, the DTDs may also be made available 
        to the public by using the PUBLIC keyword. Below is the generic format for referencing a PUBLIC DTD<br><br>
    	<table border="1" cellpadding="0" width="100%">
      		<tr><td width="100%"><font color="black" size="1">&lt;!DOCTYPE root_element PUBLIC &quot;dtd_name&quot; &quot;URL_of_external_dtd&quot;&gt;</font></td></tr>
    	</table><p>In usage, it would look more like the following:</p>
      	<p>&lt;!DOCTYPE contacts PUBLIC &quot;contact_dtd&quot; &quot;http://www.mydomain.com/dtds/contacts.dtd&quot;&gt;</p>
      	<p><img border="0" src="grafix/dtddtd1.gif" width="27" height="20">The 
        names used for DTDs may contain only alphanumeric characters, the space, 
        new line characters, and the following punctuation: - _%$#@()+:=/!*;?. 
        Also, DTD names follow some general standards.</p>
	]]></description>
	</sub-tree1>
	<sub-tree1 name="ISO standard DTDs"><description><![CDATA[<p>ISO standard DTDs begin with ISO.  There are two types:
      	<table border="0" cellpadding="0" cellspacing="0" width="100%">
      		</table>
      		<li><font color="black">Approved non-ISO standard DTDs begin with a plus (+) sign.</font></li>
      		<li><font color="black"> Non approved non-ISO standard DTDs begin with a dash (-).</font></li>
        <p>For example:</p><p>&lt;!DOCTYPE contacts PUBLIC &quot;-//Your 
        Name//Contact Data//EN&quot; &quot;http://www.mydomain.com/dtds/contacts.dtd&quot;&gt; </p>
      	<p>Whichever the case, the format is same as above. Where <b>Your Name</b> is the owner of the DTD, <b>Contact 
        Data</b> is the type of document the DTD describes, and <b>EN </b>is the language reference (ISO 639).</p>
	]]></description>
	</sub-tree1>
</group>
</category>
</tutorial>	
