The Standard Generalized Markup Language (SGML; ISO 8879:1986) is a standard for defining generalized markup languages for documents. ISO 8879 Annex A.1 states that generalized markup is "based on two postulates":
Declarative: Markup should describe a document's structure and other attributes rather than specify the processing that needs to be performed, because it is less likely to conflict with future developments. Rigorous: In order to allow markup to take advantage of the techniques available for processing, markup should rigorously define objects like programs and databases. DocBook SGML and LinuxDoc are examples which used SGML tools.
Standard versions SGML is an ISO standard: "ISO 8879:1986 Information processing – Text and office systems – Standard Generalized Markup Language (SGML)", of which there are three versions:
Original SGML, which was accepted in October 1986, followed by a minor Technical Corrigendum. SGML (ENR), in 1996, resulted from a Technical Corrigendum to add extended naming rules allowing arbitrary-language and -script markup. SGML (ENR+WWW or WebSGML), in 1998, resulted from a Technical Corrigendum to better support XML and WWW requirements. SGML is part of a trio of enabling ISO standards for electronic documents developed by ISO/IEC JTC 1/SC 34 (ISO/IEC Joint Technical Committee 1, Subcommittee 34 – Document description and processing languages) :
SGML (ISO 8879) – Generalized markup language SGML was reworked in 1998 into XML, a successful profile of SGML. Full SGML is rarely found or used in new projects. DSSSL (ISO/IEC 10179) – Document processing and styling language based on Scheme. DSSSL was reworked into W3C XSLT and XSL-FO which use an XML syntax. Nowadays, DSSSL is rarely used in new projects apart from Linux documentation. HyTime – Generalized hypertext and scheduling. HyTime was partially reworked into W3C XLink. HyTime is rarely used in new projects. SGML is supported by various technical reports, in particular
ISO/IEC TR 9573 – Information processing – SGML support facilities – Techniques for using SGML Part 13: Public entity sets for mathematics and science In 2007, the W3C MathML working group agreed to assume the maintenance of these entity sets.
History SGML descended from IBM's Generalized Markup Language (GML), which Charles Goldfarb, Edward Mosher, and Raymond Lorie developed in the 1960s. Goldfarb, editor of the international standard, coined the "GML" term using their surname initials. Goldfarb also wrote the definitive work on SGML syntax in "The SGML Handbook". The syntax of SGML is closer to the COCOA format. As a document markup language, SGML was originally designed to enable the sharing of machine-readable large-project documents in government, law, and industry. Many such documents must remain readable for several decades—a long time in the information technology field. SGML also was extensively applied by the military, and the aerospace, technical reference, and industrial publishing industries. The advent of the XML profile has made SGML suitable for widespread application for small-scale, general-purpose use.
Document validity SGML (ENR+WWW) defines two kinds of validity. According to the revised Terms and Definitions of ISO 8879 (from the public draft):
A conforming SGML document must be either a type-valid SGML document, a tag-valid SGML document, or both. Note: A user may wish to enforce additional constraints on a document, such as whether a document instance is integrally-stored or free of entity references. A type-valid SGML document is defined by the standard as:
An SGML document in which, for each document instance, there is an associated document type declaration (DTD) to whose DTD that instance conforms. A tag-valid SGML document is defined by the standard as:
An SGML document, all of whose document instances are fully tagged. There need not be a document type declaration associated with any of the instances. Note: If there is a document type declaration, the instance can be parsed with or without reference to it.
Terminology Tag-validity was introduced in SGML (ENR+WWW) to support XML which allows documents with no DOCTYPE declaration but which can be parsed without a grammar, or documents which have a DOCTYPE declaration that makes no XML Infoset contributions to the document. The standard calls this fully tagged. Integrally stored reflects the XML requirement that elements end in the same entity in which they started. Reference-free reflects the HTML requirement that entity references are for special characters and do not contain markup. SGML validity commentary, especially commentary that was made before 1997 or that is unaware of SGML (ENR+WWW), covers type-validity only. The SGML emphasis on validity supports the requirement for generalized markup that markup should be rigorous. (ISO 8879 A.1)
Syntax An SGML document may have three parts:
the SGML Declaration, the Prologue, containing a DOCTYPE declaration with the various markup declarations that together make a Document Type Definition (DTD), and the instance itself, containing one top-most element and its contents. An SGML document may be composed from many entities (discrete pieces of text). In SGML, the entities and element types used in the document may be specified with a DTD, the different character sets, features, delimiter sets, and keywords are specified in the SGML Declaration to create the concrete syntax of the document. Although full SGML allows implicit markup and some other kinds of tags, the XML specification (s4.3.1) states:
Each XML document has both a logical and a physical structure. Physically, the document is composed of units called entities. An entity may refer to other entities to cause their inclusion in the document. A document begins in a "root" or document entity. Logically, the document is composed of declarations, elements, comments, character references, and processing instructions, all of which are indicated in the document by explicit markup. For introductory information on a basic, modern SGML syntax, see XML. The following material concentrates on features not in XML and is not a comprehensive summary of SGML syntax.
… excerpt ends here. Continue reading the full article.


