XML Tutorials

  Home arrow XML Tutorials arrow Validation with Document Type Definiti...

Validation with Document Type Definitions (DTDs)
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3

    Table of Contents:
  • Validation with Document Type Definitions (DTDs)
  • Getting to Know DTDs
  • Creating an XML Prolog
  • Whitespace



    Validation with Document Type Definitions (DTDs)

    (Page 1 of 4 )

    In this article you will learn to work with Document Type Definitions or DTDs. These allow you to validate your XML documents which are well-formed. XML document descriptions (which is what DTDs and Schemas are), are statements that decide how content can/must appear in your XML documents. The document descriptions are read by software and then your document is checked against this description to ensure that all of the rules are followed.

    In our previous article we learned how to create well-formed XML documents, and learned the rules to ensure we created them properly. We also touched further upon the hierarchy structure of the parent, child, and sibling scheme.

    About Document Descriptions

    Document descriptions are a form of metadata because they contain data that helps to describe other data. Below is a list of data you can expect to find in your document descriptions: 

    1. Some description of the elements that exist in your document.

    2. A description of the kind of content that your elements can have.

    3. The order in which your elements can/must appear in your document.

    4. A range that element attribute values must contain or content values elements must have.

    5. How many times an element may occur.

    6. A guide to the relationships of the various elements that exist in your document. 

    In short, these metadata or definitions hold the rules for describing your data, and not the actual data itself. 

    Should You Create a Document Description? 

    Here is a list of reasons why you might wish to create a document description. It is not mandatory to do so by any means, so take these reasons into consideration when deciding if you should create one or not: 

    1. If you need to specify certain types of content not available somewhere else.

    2. If you want to have a set of rules for your document and have the ability to ensure those rules are being followed. Your document description makes this an automated task.

    3. If you have definitive data to collect, store, or organize.

    4. You wish to create a new industry standard.

    5. If the data you collect is unwieldy or complicated. 

    You probably should not use a document description if the following applies to you: 

    1. There is already a document description that fits your needs.

    2. If you only have a single or simple document, there is no need to complicate matters with a document description.

    3. If you are working with a relatively small and simple amount of data. 

    More XML Tutorials Articles
    More By James Payne

    blog comments powered by Disqus


    - Validation with Document Type Definitions (D...
    - Creating a Well-Formed XML Document
    - Getting to Know XML
    - A Friendly Approach to XML
    - Creating RSS 2.0 Feeds
    - Using Modules in Your RSS Feed
    - RSS 2.0
    - Querying XML: Use Cases
    - Joins and Query Use with XML
    - Solving Problems by Querying XML
    - Performing Set Operations When Querying XML
    - Querying XML
    - Handling Data for Ajax with JSON
    - Handling XML Data for Ajax
    - XML and JSON for Ajax

    Developer Shed Affiliates


    © 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap