
 
									
 
				 
				
			To use XML you need a DTD (Document Type Definition). A DTD contains the rules for a particular type of XML-documents. Actually it's the DD that defines the language.
A DTD describes elements. It uses the following syntax:
 The text <! ELEMENT, followed by the name of the element, followed by a description of the element.
 For instance:
<!ELEMENT brand (#PCDATA)>
 This DTD description defines the XML tag <brand>.
The description  (#PCDATA) stands for parsed character data.
 It's the tag that is shown and also will be parsed (interpreted) by the program that reads the XML document.
 You can also define (#CDATA), this stands for character data.
 CDATA will not be parsed or shown.
An element that contains sub elements is described thus: <!ELEMENT car (brand, type) >
 <!ELEMENT brand (#PCDATA) >
 <!ELEMENT type (#PCDATA) >
This means that the element car has two subtypes: brand and type. Each subtype can contain characters.
If you use <!ELEMENT car (brand, type) >, the sub elements brand and type can occur once inside the element car. To change the number of possible occurrences the following indications can be used:
+ must occur at least one time but may occur more often
 * may occur more often but may also be omitted
 ? may occur once or not at all
With the sign '|' you define a choice between two sub elements. You enter the sign between the names of the sub elements. <!ELEMENT animal (wingsize|legsize) >
Empty elements get the description EMPTY.
 For instance
<!ELEMENT separator EMPTY>
 that could define a separator line to be shown if the XML document appears in a browser.
A DTD can be an external document that's referred to. Such a DTD starts with the text
<!DOCTYPE name of root-element SYSTEM "address"> The address is an URL that points to the DTD.
In the XML document you make clear that you'll use this DTD with the line: <!DOCTYPE name of root-element SYSTEM "address">
 that should be typed after the line <?xml version="1.0"?>
A DTD can also be included in the XML document itself. After the line <?xml version="1.0"?> you must type <!DOCTYPE name of root-element [
 followed by the element definitions.
 The DTD part is closed with
]>