Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Q1324 What is the advantage of having DTD in an xml document?

You are here: irt.org | FAQ | XML | Q1324 [ previous next ]

The reason why you want to include DTD's in XML documents, is that the DTD is a vocabulary of the XML elements that you use.

For example consider the below simple XML document:

        <description>Danish shoes</description>

In this case the DTD would contain the following elements: product, description, size, and prize

The DTD then lets you do validation in your XML document (are you using 'allowed' elements), and it also describes what kind of element for example the price element is (e.g. is it PCDATA?).

Last, but not least, there is currently work going on at the W3C on schemas, which is planned to replace DTD's in the near future.

©2018 Martin Webb