Knowing
the different components of a DTD file would help you to understand
the concepts of DTD and XML very well. Consider the DTD example given
below.
_______________________________________________
<!ELEMENT
books (book+) >
<!ELEMENT book (title, author+) >
<!ELEMENT title (#PCDATA) >
<!ELEMENT author (#PCDATA) >
The ELEMENT
keyword is used to define an element in the DTD file. The word next
to the ELMENT keyword is the name of the element that will be present
in the XML file. After the element name some text will be available
in the brackets. These are the names of the child nodes of that element.
The different
child nodes are separated by a comma. A plus sign after the node name
indicates that it can be present one or more times within that element.
Similarly sign like '?' and '*' are also used in it. Data types defined
in the DTD are PCDATA and CDATA.
A DTD can
be embedded within an XML file or it can be separate in an external
file.