eWebProgrammer eweb  

DTD Basics   «Prev  Next»
Lesson 10A checklist for creating DTDs
ObjectiveCreate a DTD from an existing set of tags.

Checklist for creating Document Type Definitions

The following checklist outlines the steps you can take to create a DTD from an existing set of tags:
  1. Determine the root element for the document.
  2. List all the other elements used in the document.
  3. Create the document tree structure for these elements.
  4. Note whether elements need to appear in a specific order.
  5. Note whether certain elements have content that must be present, can be present, or may be present multiple times.
  6. Note which elements will contain text, which will only contain other elements, and which may contain both.

As you have seen so far, you can write well-formed XML by following a few simple rules. In effect, these rules describe how to determine one of XMLs key characteristics: its structure.
Without the rules, the material is ambiguous and well-formedness only goes so far. Several other technologies are available for validating XML documents, each with their own advantages and disadvantages.
Document Type Defi nitions (DTDs) offer a way of specifying further rules that help in the interpretation of documents and their structure. By using namespaces it is possible to create unambiguously distinct sets of elements and attributes according the purpose you have in mind. Whether or not they appear in a namespace, such special-purpose sets of terms are sometimes known as vocabularies. You can describe the structure and vocabulary of a XML language in a software-friendly fashion, which can be used to check whether XML documents meet the requirements. This checking is known as validation.
DTD Mechanics Creation
The next lesson concludes this module.

DTD Checklist - Exercise

Click the Exercise link below to create a DTD.
DTD Checklist - Exercise