XML
  Home arrow XML arrow Page 8 - The Fundamentals of DTD Design
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Rational Software Development Conference
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

The Fundamentals of DTD Design
By: Vikram Vaswani, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 6
    2001-09-27

    Table of Contents:
  • The Fundamentals of DTD Design
  • DTD Who?
  • Rainy Days
  • Simply Elementary
  • What's The Frequency, Bobby?
  • Turning Up The Heat
  • An Entity In The Attic
  • The Old Popcorn Trick

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    The Fundamentals of DTD Design - The Old Popcorn Trick
    (Page 8 of 8 )

    And that just about covers everything I have to say on the topic. Before I go, though, I'd like to run through a composite example illustrating everything you've learned thus far.

    Take a look at the following XML document

    <?xml version="1.0"?> <!DOCTYPE review SYSTEM "movie.dtd"> <review id="42"> <header> <title>Pearl Harbor</title> <cast>Ben Affleck, Josh Hartnett and Kate Beckinsale</cast> <director>Michael Bay</director> <duration units="m">167</duration> <genre>Drama</genre> <slug>War Games</slug> <author>J. Doe</author> <date>2001-08-08</date> </header> <body> <para>On December 7, 1941, Japan unexpectedly attacked the American naval base at Pearl Harbor, hoping to gain the initiative in the war against Europe. As it turned out, the attack had the effect of galvanizing the <quote>sleeping American giant</quote>, resulting in the utter rout of the Japanese and German armies and bolstering America's dominant role in world politics. </para> <para>While <title>Pearl Harbor</title>'s love story may seem unbelievably trite, the effects are most certainly not. The Japanese attack on the naval port is described in tremendous detail, and is perhaps the most compelling reason to watch this film. With over forty minutes of reel time devoted to the attack, you've probably never seen anything like it before; it's a visual spectacle that hits home more than any written description ever will. Bay's direction is superb - he knows just where to put the camera, and he always gets the money shot - and the cinematography and visuals - especially those shot in the train station, with steam billowing out in the background - simply gorgeous. </para> <para>While I think the love story embedded within <title>Pearl Harbor</title> isn't really all that compelling - <title>Moulin Rouge</title> did it better - this is still a film worth watching, if only to understand a little bit of history! </para> </body> </review>
    and then see if you can put together a DTD for it. Here's my version:

    <!-- element declarations --> <!ELEMENT review (header,body) > <!ELEMENT header (title,cast,director,duration,genre,slug,author,date) > <!ELEMENT title (#PCDATA) > <!ELEMENT cast (#PCDATA) > <!ELEMENT director (#PCDATA) > <!ELEMENT duration (#PCDATA) > <!ELEMENT genre (#PCDATA) > <!ELEMENT slug (#PCDATA) > <!ELEMENT author (#PCDATA) > <!ELEMENT date (#PCDATA) > <!ELEMENT body (para+) > <!ELEMENT para (#PCDATA|quote|title)* > <!ELEMENT quote (#PCDATA) > <!-- attribute declarations --> <!ATTLIST review id CDATA #REQUIRED > <!ATTLIST duration units (m | h) "m" >
    And that's about it from me. In case you're interested in finding out about the more arcane aspects of DTDs - notations, parameter entities and overrides - you should consider checking out the following links.

    The W3C's XML specification, at http://www.w3.org/TR/2000/REC-xml-20001006

    The DocBook DTD, a specification for technical manuals and material, at http://www.oasis-open.org/docbook/xml/4.1.2/index.shtml

    An interesting article on DTD construction, at http://www.xml.com/pub/a/2000/06/xmleurope/schemas.html

    If, on the other hand, all you were looking for was a working knowledge of DTDs to get you though your day, I hope you found it here. I'll be back soon with another article on a related technology, XML Schema, which is quickly gaining followers on account of its ease of use and powerful data-validation capabilities (think of it as DTDs on steroids, but without the nasty symbols). Until then, though...be good!
    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.

     

       

    XML ARTICLES

    - How to Set Up Podcasting and Vodcasting
    - Creating an RSS Reader Application
    - Building an RSS File
    - An Introduction to XUL Part 6
    - An Introduction to XUL Part 5
    - An Introduction to XUL Part 4
    - An Introduction to XUL Part 3
    - An Introduction to XUL Part 2
    - An Introduction to XUL Part 1
    - XML Matters: Practical XML Data Design and M...
    - Practical XML Data Design and Manipulation f...
    - SimpleXML
    - XForms Basics, Part 3
    - XForms Basics, Part 2
    - XForms Basics

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway