Previous Table of Contents Next


Chapter 3
SGML Terminology

This chapter covers the basics of SGML documents. The terminology found in this chapter applies to just about every SGML document known to man; if you have much experience with SGML, these terms will probably be familiar. If you’re new to the “language,” knowing these terms will serve you well.

This chapter covers documents, elements, attributes, entities, and their tags. You need to know these building blocks of SGML backward and forward. You must know what these terms mean, as well as how to make declarations for them in documents and in DTDs in order to build an SGML application. Because you must also understand how the structural components of your documents differ from content, this chapter makes some suggestions in that vein.

In this chapter, you learn:

  What the document components, elements, attributes, entities, and content are and how to use them
  What the components of a DTD and its markup are
  What tags are
  What declarations you find in documents and DTDs
  What the difference is between declarations in DTDs and documents
  Tips on keeping your content and structure straight with structural diagrams

What Are the Components of SGML Documents?

SGML documents consist of content and markup. Note that format is not necessarily considered an integral part of an SGML document since a single document’s content can appear in many different formats. The content is what you want to say and the markup is the SGML that keeps the document’s integrity as it moves through different environments. Your document’s markup consists of two things: tags and declarations.

Tags are the marks that tell your SGML system—and all SGML systems—what structural role the content within the tags plays. SGML systems process all documents by interpreting SGML markup and portraying documents with their intended structure and content. Tags make for easy dismantling and reassembly of documents, just like professional movers who tag and box your belongings when they move you to a new house. For example, if your SGML processing system encounters <TITLE>This is the title </TITLE> in a document, it will treat the content appropriately and not lose track of it or its properties.

Document Declarations

Declarations are markup that makes special statements directly to your SGML processing system about how to process your document. They don’t describe the structural role of particular content like tags do, but they tell the processing system standardized information, like what type of document is being processed and where its DTD is located. You normally make most declarations in DTDs, where tags are defined for document types, but individual documents must have declarations too.

Each SGML document is called a document instance. But you need to distinguish the document type from the instance of that type. For example, think of two document instances: a memo from the boss and a service bulletin on widget replacement. SGML systems need to be told that the memo from the boss is a “memo” document type and that the service bulletin on widget replacement is a “service bulletin” document type. (Though some SGML systems can nearly figure this out for themselves, they are the exception.) In SGML parlance, the memo from the boss is an instance of the memo document type, and the service bulletin on widget replacement is an instance of the service bulletin document type. The SGML processing system learns what type of document it is from special declarations at the beginning of each document.

The SGML Declaration and the DOCTYPE Declaration. Document instances in SGML require two types of declarations: the SGML declaration and the DOCTYPE (document type) declaration. (The word DOCTYPE actually appears in the declaration itself.) The SGML declaration tells the system that the document is an SGML document so that the system knows it should follow SGML rules while handling this document instance.


• See “The DOCTYPE Declaration,” p. 177

But the system must also know the type of SGML document. The document type declaration tells the SGML system what type of document the instance is and says where the DTD for that document type resides.


Previous Table of Contents Next