• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 24. XML > XML and DTDs

XML and DTDs

A DTD (short for “document type definition”) is a plain text file that is created with a simple text editor. A DTD specifies which elements will be in an XML file, the kind of information that can be put into an element, the order of the elements in the XML file, and which elements can contain subelements (nested elements). A DTD, while not required for XML creation, controls the relationships between elements and helps keep elements consistent between documents.

Using elements

Elements in a DTD are similar to fields in a database. The more specific the fields are, the more specific will be the data they contain, and the more varied the ways the data can be extracted and organized into different reports or presentations in an HTML or print document.

For comparison, think of a mail merge function, where each line of an address is defined as an individual element. Rearranging the elements would alter how the individual lines of the address could be displayed. Specified lines of the address could be used in an output document (say, using just names and business titles) without using the remaining lines of the address. All this rearranging and reorganizing is controlled using elements in an XML file.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint