Previous | Table of Contents | Next |
You know how to do some SGML now, but there is much more to SGML than just writing a DTD or marking up a document instance. There is the issue of good judgment when it comes to design. Design issues quickly become maintenance issues. If you inherit someones DTD that was not designed well, then you have a maintenance problem.
In this chapter, you learn:
These questions are important because SGML does not always alert you when you do something wrongat least not right away. It lets you get away with many mistakes. Parsing errors mainly deal with syntax, not overall design. In this chapter, you learn how to avoid the major pitfalls.
Deciding whether to make a tag an element or attribute is difficult when you cant decide what the object youre working on really does and how it does it. Suppose, for example, that you want to describe where a graphic object is located. Call it fileloc for file location. The object is visible in the document. You could tag it every time it appears. Do you call it an element or an attribute?
Note:
When you think you understand the difference between elements and attributes, look at the structural objects in a magazine article. Pretend that youre the production editor and the SGML analyst. See whether you can figure out what the elements are for the documentthe articleand its attributes. Whether you are right or wrong is not so important. The exercise in thinking about elements and attributes will be worth far more to you in the long run than getting it right.
The following note about elements being the object and attributes defining an aspect of the object helps, but sometimes theres more to it. Remember when you were in a class, and there was someone who just did not get it? Or maybe the someone was you when your dad was explaining something about cars or refrigerators. You felt like the odd person out. Everyone else in the class seemed to understand. What everyone else had was the feel of the subject matter. SGML is like that when it comes to attributes and elements.
Note:
The element is the structural object, and the attribute defines an aspect of it. If the element were <GRAPHIC>, the attribute could be location and the values could be local and remote. If the element were <ATTENDANCE>, the attribute could be status and the values could be present and absent.
The question becomes, Is it an attribute or not? It is probably an element if it is not an attribute. The other choice is an entity, which is discussed in Chapter 10. There are four main types of attributes:
See Entities: Their Use and The ENTITY Markup Declaration, p. 184
There are other types of attributes; not all attributes fall into these categories. You can call your objects whatever you want, as long as you follow SGML syntax.
Previous | Table of Contents | Next |