Previous Table of Contents Next


Defining Structure in SGML

The structure of a document—its type—is defined by a document type definition, or DTD. The DTD is a blueprint of the document; it can be simple or complex. It specifies what elements are allowed, whether they are required or optional, and the order in which they can occur.

The DTD lays out the rules for a document through the use of elements, attributes, and entities (see Chapter 3, “SGML Terminology”). To get an idea of how SGML handles structure, consider figure 2.6, which shows a simple DTD.


Fig. 2.6  This document type definition defines the document structure of the product advisory bulletin.

The DTD defines the product advisory document. Even though its structure is simple, it still has rules. Within the DTD, elements are the building blocks of the document structure. The DTD defines the rules for what an element can contain—specific characters, values, or collections of other elements.

In the DTD, the element advisory contains child elements, or subelements, that make up the bulletin. Table 2.1 describes the subelements that represent the major components of the document.

Table 2.1 Subelements in the Product Advisory Bulletin

Element Name Description

advnbr Advisory number
type Advisory type
dateiss Date issued
daterev Date revised
subject Advisory subject
subsec Subsection


• See “What Are the Components of SGML Documents?” p. 47

• See “Entities,” p. 58



Note:  
The element subsec contains additional elements, some of which are referenced via entities.

Using Structure in SGML

The DTD also defines the tag set that corresponds to the structural notation of the document. Combined with the text of the document, these tags fit the text into the structure that’s defined in the DTD. If this sounds confusing, take a look at a tagged document. Figure 2.7 shows the SGML tagged text—or markup—of the product advisory bulletin.


Fig. 2.7  This is a view of the product advisory bulletin as an SGML document “instance.”

From Here…

You now have completed an initial tour of the SGML view of documents. You have examined the key concepts of structure, content, and format. You saw how SGML uses these components to create modular and transportable documents.

For more information, see the following:

  Chapter 3, “SGML Terminology,” gives you the specifics of SGML terminology and structure.
  Chapter 4, “The Basic Procedure,” takes you through the process of creating an SGML document environment.
  Chapter 5, “Two Scenarios,” discusses the two common approaches for getting your documents into SGML.
  Part II, “Document Analysis,” takes you through the process of analyzing the structure of your document collection.
  Part III, “Content Modeling: Developing the DTD,” discusses the process of creating DTDs that accurately reflect your documents.
  Part VII, “SGML Tools and Their Uses,” examines some of the powerful SGML software tools that are just now becoming available.


Previous Table of Contents Next