XML Tutorials

  Home arrow XML Tutorials arrow Page 4 - Validation with Document Type Definiti...
XML TUTORIALS

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

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

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Validation with Document Type Definitions (DTDs) - Whitespace


    (Page 4 of 4 )

     

    I will not spend much time on white space. White space is spaces and line breaks, carriage feeds, and tabs. It is okay to include it outside of your elements, so that it is easier to read. But do not include it inside of your elements, as it can cause errors in certain instances. For example: 

    <albums>

     

    <album></album>

     

    </albums> 

    is okay. Above we have used line breaks to space out our elements for easier reading, and a tab indent to make it more noticeable that <album></album> is a child of <albums>. An incorrect way to write the above would be like this: 

    <albums>

     

    <album > </ album>

     

    </albums> 

    Instructions for Processing 

    These are used to give instruction to the processor that is processing your XML document. Here is an example of how to write one: 

    <?name data?> 

    We will further discuss these in a later article. For now, here is an example of how you would use your instructions to get a stylesheet: 

    <?xml:stylesheet type=”text/css” href=”albums.css”?> 

    Final Words 

    That is it for this article. In the next article you will learn to read a DTD and declare elements. You will also learn about entities and how to use them. The article following that will go into a discussion on how to write XML Schemas and whether you should use them instead of DTDs. 

    Thank you for reading my article. If you have comments or questions, please feel free to leave them.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.
    blog comments powered by Disqus

    XML TUTORIALS ARTICLES

    - 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


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