>> English << | česky | Español | По-русски | Français | Italiano | Deutsch | MagyarZVON > Tutorials > DTD Tutorial
>> Example 1 << | Prev | Next | Contents


An XML document is valid if it has an associated document type definition and if the document complies with the constraints expressed in it. The document type definition must appear before the first element in the document. The name following the word DOCTYPE in the document type definition must match the name of root element.


A document can contain only the root element tutorial which can contain some text. :

<!ELEMENT tutorial (#PCDATA)>

Valid documentsTop

A valid document containing some text.:

 <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

<tutorial>This is an XML document</tutorial>

This document is also valid.:

 <!DOCTYPE tutorial SYSTEM "tutorial.dtd">


Documents with errorsTop

Root element does not conform to the given DTD.:

 <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

<text>This is an XML document</text>