What Is a DTD?

A document type definition (DTD) describes the structure of a document. It specifies which elements can contain which other elements, which elements are optional and which are required, and which elements contain data. For example, a DTD might specify that a book element

  • Must contain exactly one title element
  • Can contain any number of author elements
  • Might contain a subtitle element

To use a DTD, you must associate it with an XML document. A DTD can be internal or external. An internal DTD is inside the XML document that uses it. It appears in the DOCTYPE element, which immediately follows the XML declaration at the beginning of the document. An external DTD is in a separate file. An XML document that uses an external DTD specifies the path for the DTD in its DOCTYPE element. For example, the following DOCTYPE element specifies that bookstore is the root element in this XML document, and that the DTD that this document uses is stored in the file system at C:\mydir\bookstore.dtd:

<!DOCTYPE bookstore SYSTEM "file://C:\mydir\bookstore.dtd">
               

            

A document instance is an XML document that uses a particular DTD. In other words, the contents of a document instance have been tagged according to the structure defined in the DTD it is associated with. For example, if the contents of the bookstore.xml file follow the structure defined in the bookstore.dtd file, bookstore.xml is a document instance of the bookstore DTD.

Stylus Studio Blogs

Blogging is the hottest fad on the Internet and Stylus Studio has jumped on the bandwagon. Bookmark these XML Blogs to keep up with all the latest XML buzz in the internet blogosphere. Includes RSS and Atom Feeds!

DB2

IBM DB2 is a database management system for powering business applications. Learn how to build XML solutions on DB2 using Stylus Studio's DB2 tools.

An Introduction to XQuery Development

An Introduction to XQuery demonstrates how easy it is to use Stylus Studio's many tools for editing, testing and deploying XQuery applications. Learn how to write your first XQuery application in just minutes by watching this online tutorial.

Scientific, Photo & Control Equipment

Scientific, photo & control equipment companies hear clicks and beeps all day. But, when it comes to data integration it needs to be done in a flash, that's why they use Stylus Studio. Come see which top companies are seeing XML in a brand new light!

Stylus Most Wanted

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.