Previous Table of Contents Next


Types of Data for Attributes


• See “Attributes: Their Use and the ATTRIBUTE Declaration,” p. 182

• See “Where To Define Attributes,” p. 224


Other content types also show up in attributes. Attributes often are declared immediately after the element. (Attributes can be declared in their own section of a DTD, but it’s clearer if you declare them together with the element they modify.) They are practically part of the element declaration. For example:

    <!ELEMENT graphic     - -  EMPTY     >
    <!ATTLIST graphic
               file       CDATA         #REQUIRED
               frame      CDATA         #REQUIRED
               units      (in|cm|pt)    "in"
               size       NUTOKEN       #IMPLIED   >

Table 7.3 summarizes the 15 types of declared value content that can be used in attributes.

Table 7.3 Types of Content That Appear in Attribute Declarations

Keyword Attributive Value

CDATA Character data
ENTITY General entity name
ENTITIES General entity name list
ID Unique identifier
IDREF Identifier reference value

IDREFS Unique ID reference value list
NAME Name
NAMES Name list
NMTOKEN Name token
NMTOKENS Name token list

NOTATION Notation name
NUMBER Number
NUMBERS Number list
NUTOKEN Number token
NUTOKENS Number token list


Note:  
Don’t confuse the keywords used in the attribute content types with the keywords used in element content types. Table 7.2 applies to element content, while table 7.3 applies to attribute content.

SGML looks at characters that stream through it in various ways. It classifies characters by function and as names, SGML characters, non-SGML characters, and data.

Tokens are a way in which SGML recognizes content with a type of shorthand. Names and numbers can have tokens, which make dealing with them easier when you have to follow SGML syntax rules.

The Definition Process

The definition process consists of ten steps. You should go through them systematically. You’ll write a better DTD that will be easier for others to understand. You’ll probably have the greatest success if you follow a workshop approach similar to the one that you followed in the last chapter when defining your environment. This process should emphasize the cooperation of everyone involved, because no matter how confident you are that you understand what should be defined, this process will improve even your best efforts at defining the elements.

Step 1: Pick a Document Type

You are probably dealing with several types of documents. Gather ten to twenty samples of your chosen document type. If you choose service bulletins, have many samples on hand. Also bring in some departmental experts (or your in-house experts) on service bulletins. Ensure that everyone in the room has a copy of all the samples and gets a chance to voice ideas and concerns about special features of that document type. SGML consultants can help you with syntax, but they do not know how you create your documents or how you use them. So count on your in-house experts.

Step 2: List the Elements

The first general element should be the most inclusive element. It’s probably something like <SERVBULL>service bulletin document content<\SERVBULL>. Now write down the names of the other elements on a chalkboard, overhead projector, or some place where everyone in the room can see and approve them. These elements have relationships with one another, so use a structure diagram to keep track of the relationships. Keep listing elements until you have them all accounted for.

Step 3: Name Each Element and Assign Relationships

There are many ways to keep track of the relationships among elements. The GLA Consortium sells a jigsaw puzzle kit that lets you write the names of elements on puzzle pieces and connect them to show relationships between elements. You can move the puzzle pieces around to show different relationships and add attributes and entities to elements.

You can also label empty wastebaskets with the names of the large elements. In the case of service bulletins, you can label wastebaskets with major elements for that document type—servbull, action, effectivity, material information, and so on. Drop each subelement into the appropriate wastebasket.

You can accomplish much the same thing with a piece of paper and a structure diagram for each element and its subelements. Include a brief description of what the element is and what it does. Put into words what its relationship is to the rest of the elements. This is only a draft, so don’t worry about making the definition perfect yet. Each element can have a written description, as well as a graphic structure tree of what it contains. You’ll need these descriptions for step 8, so don’t skip over this description step.


Previous Table of Contents Next