SGML (Standard Generalized Markup Language)
1. Definition
SGML is an ISO standard (ISO 8879:1986) meta-language for defining markup languages and describing documents. It does not itself define tags — instead it lets you define a DTD that specifies which tags exist and how they may be nested. HTML is one SGML application.
2. Key Concepts
| Concept | Meaning |
|---|---|
| DTD | The grammar: declares elements, attributes, entities, content models |
| Element | Logical unit marked by start/end tags (<para>...</para>) |
| Attribute | Property of an element (<img src="x">) |
| Entity | Named replacement text (&, custom macros) |
| Marked section | Conditional content (<![CDATA[ ... ]]>) |
| Processing instruction | Directive to an application (<? ... ?>) |
| Minimisation | Optional omission of tags (HTML-style tag omission comes from SGML) |
3. How SGML Works
1. Design a DTD -> defines your document model
<!ELEMENT chapter (title, para+)>
<!ELEMENT para (#PCDATA | emph)*>
<!ATTLIST para id ID #IMPLIED>
2. Write documents (instances) conforming to that DTD
<chapter><title>Intro</title><para>Hello <emph>SGML</emph>.</para></chapter>
3. An SGML parser validates the instance against the DTD
4. Style/formatting (e.g. DSSSL) or further processing renders it
So: DTD + instance + parser = structured, valid document.
4. Advantages
- Platform, vendor and application independent — pure ASCII/Unicode text.
- Extremely flexible — invent the markup your domain needs (legal, aircraft manuals, encyclopaedias).
- Longevity — documents outlive software; validated structure supports long-term archiving.
- Powerful features: sophisticated content models, entities, minimisation.
5. Limitations (why XML superseded it)
- Huge complexity — full SGML parsers are hard to write and expensive.
- Optional features (omissible tags, short references, concurrent markup) made tools non-interoperable.
- Poor fit for the web (heavier than needed, no built-in linking/hypermedia).
XML (1998, W3C) = a trimmed-down SGML subset that keeps DTD validation but drops the complex features, and is web-friendly — this is what the web actually uses.
6. Where SGML is Still Used
Defence/aerospace technical manuals (CALS), legislative and regulatory publishing (legal docs), large archival publishing houses, and as the parent standard of HTML/XML definitions.
7. Exam Points
- What is SGML? Explain its role as a meta-language with a DTD example — 7 marks.
- Explain SGML components (elements, attributes, entities, DTD) — 7 marks.
- State advantages of SGML and the reasons XML replaced it on the web — 5 marks.
- Relationship SGML–HTML–XML — 5 marks.