\title{Elements of SGML} \author{Jonathan Fine} \def \jfmacro #1{\smallskip\noindent\vadjust{\nobreak}{\itshape #1}} \begin{Article} \noindent I don't have time to write a proper column for this issue, but I did not want too long to go by before giving the answers to the exercises at the last of my last article, in Baskerville~4(5). So here are the answers. \jfmacro {When was the SGML standard published? } The standard was published in 1986. Although an international standard, it is still far from being a \emph{de facto} standard in most of areas of application. One reason for this is resistance from the owners of proprietary document formats, as used by word processors, desktop and larger publishing systems and so forth. Would it be a sound commercial move for the owners of, say {\em Word\/} to open it up so that it could be used with someone else's formatting software? Such as \TeX\ equipped with suitable macros? Should such happen then the next thing you know someone else will be bring out a word processor front-end {\em without\/} any formatting capabilities at all, but relying on the back end previously provided. And before you know where you are, {\em Word\/} will be just one of a number of competing software products all capable of operating on the same documents. {\em Word\/} is a registered trademark of Microsoft. At Bridewell I asked the panel what must fail if SGML is to succeed, to which Lou Burnard replied ``Proprietary data formats,'' which answer I cannot improve upon. \jfmacro {Who are the five persons involved in text processing? Who is the sixth? } In the article I listed author, designer, typesetter, implementor and publisher. The sixth was the reader. Each has a different interest in the document. Probably this list is a simplification. Geeti Granger in her talk at Bridewell (see elsewhere in this issue for a brief summary) described the production process for an encyclopedia of Chemistry that John Wiley has recently produced. This occupied two detailed transparencies. There are also editor, subeditor, proofreaders, picture editors and so forth. It is traditional, and for good reason, when establishing a database to spend a period analysing the size and structure of the data to be stored, and the operations that will need to be performed on it. And this before writing any but prototype code. It seems sensible to follow this tradition when building a publishing application based on SGML. This design should be performed by an expert (either hire one, or become one yourself, or at least follow someone else's good example) in the documents you are hoping to create, store and process using SGML and SGML-compliant software. Just as with other computer applications, beware of trusting the technical expert in the language who does not understand the activity whose facilitation is intended. This applies double to applications which involve significant interaction among people and thus to SGML applications almost without exception. Deciding on data-storage standards for text is considerably more subtle than the design of a business order processing database. And that in itself is easy enough to get wrong. Good experts in SGML document design (and I am not one) are worth good money. \jfmacro {How does SGML differ from other computer languages? } So far as I know, the purpose of all other computer languages is to describe in one way or another what it is that a computer should do. In other words they are languages for the writing of programmes. SGML is a language for the creation (and storage) of structured documents. There is no sense in SGML of anything doing anything. To use the technical terms, it is all syntax and no semantics. (Some complain that with \TeX\ it is the other way around.) SGML is deliberately neutral as to what might be done to the document. It may be stored, spell-checked, formatted, edited or deleted. Or transmitted across the World Wide Web. All this is none of the concern of SGML, although needs must be carefully considered and specified if an SGML-based application is to be successful. I like to think of SGML as being ASCII for structured documents. And is ASCII a computer language? \jfmacro {What is the purpose of the prolog? Who writes it? } The prolog contains the document type declaration, which specifies the markup elements and in which combinations, that can occur in the document instance. Technically an SGML document consists of a prolog and a document instance conforming to the markup declared in the prolog. Very often \begin{verbatim} \end{verbatim} is used to refer to an external entity which contains the element and entity declarations. All this is a little technical and should be hidden from authors (and readers). \jfmacro {What is the purpose of the SGML declaration? } Usually the SGML declaration is implied, which means that the software will supply or assume that a standard SGML declaration is to be used or will be applied. However it does contains important information about how the following document is to be parsed. For example, it indicates whether omitted tags, short references, or other markup minimization devices may be used. It also declares whether the case is significant in entity and tag names. It also gives capacity information, such as the maximum allowed length of identifiers. In short, it sets all manner of switches that control the parsing of the following document, and indicates to the parsing software what capabilities it will require. An SGML declaration can also be written for parsing software, which indicates the documents it is capable of parsing. \jfmacro {What is the purpose of the document instance? Who writes it? } At last! The author's words, written by the author (or in some cases a ghost writer). \jfmacro {How many lines in a sonnet? Is that every sonnet? } Trick question. Most sonnets have fourteen lines, but Shakespeare's sonnet~126 (O~thou my lovely boy, who in thy power) has but twelve. The pedants (oops, experts) can argue as to whether it really is then a sonnet, but when all is done, it had better appear in the appropriate place when Shakespeare's sonnets are stored or printed. An old adage has it that altogether most of a computer program is devoted to dealing with the exceptions. Or to put it another way, the devil hides in the details. This is one of the attractions of \verb"tex" the program. There's almost nowhere for the bugs to hide. \jfmacro {What is the difference between {\em mark up} and {\em markup}? } An easy one. The first is a verb, the second a noun. The words {\em mark down} and {\em markdown} have a similar relation although quite different meanings. \jfmacro {What is a declaration? } In SGML markup constructions are declared, which then makes them available for use. There is an SGML declaration (which makes SGML available one assumes), and then a document type declaration which in turn contains element, entity and attribute declarations. Other features of SGML are also activated via declarations. Even comments are enabled as text within comment declarations, according to the terminology of the standard. \jfmacro {How is SGML a compromise? Between whom? Is this good or bad? } A complete answer to this question would be the whole past, present and future history of SGML. It is a document standard, so the more features and power it provides the happier those who store documents will be. But if too much power is required, the implementors will be scared off or, perhaps worse, implement only an idiosyncratic subset of the language. Perhaps part of the success of HTML is due to it being strong enough to be useful to users, and weak enough to be implemented by developers. If too much is required of authors they will simply not use it. Thus, a considerable part of the language is concerned with making life easier for the author to create a valid SGML document instance using an ordinary text editor. One of the functions of an SGML parser is to relieve the application programmer of the burden of accomodating (and perhaps getting wrong) these author-friendly features. The question of the allowable content models (a topic we have not yet discussed) has been a subject of much complaint and disagreement from and amongst implementors and document type designers. This question is the subject of an Annex to the International Standard. \jfmacro {(Experts only) In explaining SGML for beginners, have I made any false statements? } Almost certainly yes. Mostly omissions I hope, and only the whitest of lies. I would welcome hearing of any corrections that might help beginners. \end{Article}