Authoring SGML DTD's with GELLMU1
By William F. Hammond
[email protected]
September 28, 1998
It is certainly not a new idea that SGML markup can be used to manage many things including, in particular, SGML DTD's. �(For the moment, I am at a loss to find a publicly visible example.)

The extensible nature of GELLMU (Generalized Extensible LATEX-Like MarkUp) is rooted in the fact that GELLMU may be used to author SGML documents. �

It follows, inasmuch as GELLMU may be used to prepare an SGML document, that it may be used to prepare an SGML document that is used to generate an SGML DTD. �

The following included verbatim segment is the text of a simple GELLMU document "prexdt.glm" that flows in one step, i.e., GELLMU stage 1, to "prexdt.sgml". �It is followed by a copy of the DTD for a simple SGML document type that I have named "dtd". �"prexdt.sgml" is a document under the "dtd" document type. �With a small collection of stage 3 codelets for sgmlspl, one may then generate "prexdt.dtd", which is the third included verbatim segment below. �

Of course, if this is to make any sense, it must follow that "boot.dtd" can itself be authored with the document type that it defines, and that is, indeed, the case. �

_________________________________________________________________________________________________________________________
prexdt.glm:
�\documenttype[boot.dtd]{dtd}
�\doctype{test}
�\dtdref{prexdt.dtd}
�\cmt{A�Test�DTD}
�\cmt{Does�the�recommended�usage�match�this?
���<!DOCTYPE�test�SYSTEM�"prexdt.dtd">
�}
�\begin{document}
�\elt{test}{oo}{(preamble,body)}
�\elt{preamble}{rr}{(a)}
�\elt{body}{rr}{((p|t)*)}{����BETTER}
�\enp{ts}{a|p}
�\elt{(\%ts)}{rr}{(#PCDATA)*}
�\elt{t}{rr}{((r)+)}
�\elt{r}{oo}{((c)+)}
�\elt{s}{oo}{(i,(c)*)}
�\elt{c}{oo}{(#PCDATA)*}
�\elt{i}{oo}{(#PCDATA)+}
�\end{document}

_____________________________________________________________________________
boot.dtd:
�<!--�Use�<!DOCTYPE�dtd�SYSTEM�"boot.dtd">�-->
�<!--�Use
������<!DOCTYPE�dtd�SYSTEM�"boot.dtd">
��-->
�<!ELEMENT�doctype�-�-�(#PCDATA)�--�the�name�of�the�document�type,
�����i.e.,�the�name�of�the�root�element�(which�needs�to�be�defined)�-->
�<!ELEMENT�dtdref�-�-�(#PCDATA)�--�the�(unquoted)�system�resource�name
����of�the�DTD�to�be�used�with�documents�of�the�type�"doctype";�this
����name�is�only�used�to�generate�a�comment.
����Example:�for�this�DTD:��doctype�=�dtd���dtdref�=�boot.dtd�-->
�<!ENTITY�%�dtd�"elt|enp|ent|empt|cmt">
�<!ENTITY�%�tags�"rr|ro|or|oo">
�<!ENTITY�%�charr�"spc|cma|per|ltc|gtc|qum|sol|col|scl|quo|lsq|rsq">
�<!ENTITY�%�charn�"lbr|rbr|exc|atc|hsh|dol|pct|crt|amp|ast|lpr|rpr|und">
�<!ENTITY�%�chare�"lsb|rsb|hyp|eqc|plu|vbr|bsl|tld">
�<!ENTITY�%�chara�"%charr|%charn|%chare">
�<!ENTITY�%�charh�"rdash">
�<!ENTITY�%�chars�"%chara|%charh|brk">
�<!ENTITY�%�eos�"eos|eoq|eoe">
�<!ELEMENT�(%eos)�-�O�EMPTY�--�ends�of�sentence�made�by�GELLMU�-->
�<!ELEMENT�(%chars)�-�O�EMPTY�--�33�printable,�non-alphanumeric�-->
�<!ELEMENT�(%tags)�-�O�EMPTY�--�the�tag�requirement�combinations�-->
�<!ENTITY�%�string�"#PCDATA|%chars">
�<!ELEMENT�ag0�-�-�(%string|%eos)*�--�command�argument�-->
�<!ELEMENT�dtd�O�O�(preamble,�body)>
�<!ELEMENT�preamble�-�-�(doctype,dtdref,(cmt)*)�--�zero�or�more�comments�-->
�<!ELEMENT�body�-�-�(%dtd)*>
�<!ELEMENT�elt�-�O�(ag0,ag0,ag0,(ag0)*)�--�element:
��������������name,�tags,�defn,�comments?�-->
�<!ELEMENT�enp�-�O�(ag0,ag0,(ag0)*)�--�parameter�entity:
��������������name,�defn,�comments?�-->
�<!ELEMENT�ent�-�O�(ag0,ag0,(ag0)*)�--�general�entity:
��������������name,�defn,�comments?�-->
�<!ELEMENT�empt�-�O�(ag0,(ag0)*)�--�empty�element:
��������������name,�comments?�-->
�<!ELEMENT�cmt�-�-�((%string|%eos|verb)*)�--�comment�-->
�<!ELEMENT�verb�-�-�((%string|%eos)*)�--�inline�verbatim,�OK�in�cmt�-->

_____________________________________________________________________________
prexdt.dtd:
�<!--�Use�<!DOCTYPE�test�SYSTEM�"prexdt.dtd">�-->
�<!ELEMENT�test�-�-�(#PCDATA)�--�name�of�root�tag>
�<!--�A�Test�DTD�-->
�<!--�Does�the�recommended�usage�match�this?
���<!DOCTYPE�test�SYSTEM�"prexdt.dtd">�-->
�<!ELEMENT�test�O�O�(preamble,body)>
�<!ELEMENT�preamble�-�-�(a)>
�<!ELEMENT�body�-�-�((p|t)*)�--�����BETTER�-->
�<!ENTITY�%�ts�"a|p">
�<!ELEMENT�(%ts)�-�-�(#PCDATA)*>
�<!ELEMENT�t�-�-�((r)+)>
�<!ELEMENT�r�O�O�((c)+)>
�<!ELEMENT�s�O�O�(i,(c)*)>
�<!ELEMENT�c�O�O�(#PCDATA)*>
�<!ELEMENT�i�O�O�(#PCDATA)+>

_____________________________________________________________________________
About the GELLMU verbatim command
Since GELLMU documents are amenable for processing to many ultimate target formats, including possible future formats, it is essential to make verbatim sections safe. �This means that verbatim sections cannot be prepared in the way that a LATEX "verbatim environment" is prepared. �Even the HTML "pre" command -- for pre-formatted text -- requires the preparer to escape the characters `<', `>', and `&' where they occur in the pre-formatted material. �

There are two reasonable ways to handle verbatim material in a GELLMU system:

  1. Prepare the material, as for HTML, for direct inclusion in the SGML image of a GELLMU document. �
  2. Filter the material to use symbolic character names for any character that is not strictly alpha-numeric before inserting the material inside a GELLMU verbatim command. �

_________________________________________________________________________________________________________________________
About GELLMU
GELLMU is an acronym for "Generalized Extensible LATEX-like MarkUp". �As of October, 1998 all GELLMU materials are didactic, and there has been no "release" of related code. �The GELLMU materials, under frequent revision, are available for examination. �This document on the web is https://www.albany.edu/%7Ehammond/gellmu/boot/dboot.html2 , and the durable GELLMU web entrance is http://math.albany.edu:8000/math/pers/hammond/igl.html3 . �

[Processed from GELLMU to LATEX on Fri Oct 2 16:36:29 EDT 1998]