Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | XML | Q1324 [ previous next ]

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

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:

<product>
        <description>Danish shoes</description>
        <size>41</size>
        <price>42.45$</price>
</product>

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.


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.