Easy Tutorial
❮ Dtd Validation Home ❯

DTD Introduction


Document Type Definition (DTD) defines the legal building blocks of an XML document. It uses a set of legal elements to define the structure of the document.

DTD can be declared inline in the XML document or referenced as an external file.


Internal DOCTYPE Declaration

If the DTD is included within your XML source file, it should be wrapped in a DOCTYPE declaration using the following syntax:

XML document instance with DTD (open in IE5 or higher and select "View Source"):

Open this XML file in your browser and select the "View Source" command.

The above DTD is explained as follows:


External Document Declaration

If the DTD is located outside the XML source file, it should be wrapped in a DOCTYPE definition using the following syntax:

This XML document is the same as the one above but has an external DTD: (Click to open the file and select "View Source" command.)

This is the "note.dtd" file containing the DTD:


Why Use DTD?

With DTD, every XML file can carry a description of its own format.

With DTD, independent groups can consistently use a standard DTD to exchange data.

Your application can also use a standard DTD to validate data received from outside.

You can also use DTD to validate your own data.

❮ Dtd Validation Home ❯