Type the document given in Figure 2 into a file, and check it with the distributed SGML parser, as follows.
Firstly, and most importantly, try converting your document to
HTML. This uses the script sgml2docs
. If the document is in a
file sun1234.sgml
, give the command sgml2docs
sun1234.sgml
, which will transform your document into a collection of
HTML files, and package them up into a tar-file by the name of
sun1234.tar
. Alternatively, give the command
sgml2docs --latex sun1234.sgml
, which will transform your
document into a LaTeX file, and place it, and any figures required
for processing into a file sun1234.tar
(note that the same
output filename is used for both formats, by default). See Section 6.2 for further details and options.
Another way of processing your document is to run the underlying
parser on the document - this is the most efficient way of checking
that your document is valid, in the sense that it conforms to the DTD
is claims to. Give the command parse -s sun1234.sgml
(see
the detailed documentation for the parse script). This invokes the
nsgmls
parser, and, with the -s
option, suppresses all
output except warnings and error messages. This means that for a
valid document, you should see precisely no output from this command.
If you want to see output, leave off the -s
option and the
parser will produce a version of your document in a form (documented
elsewhere) which is easy for a downstream application to
parse. If you are experiencing puzzling validation errors with a
document, it can occasionally be useful to examine this output: if you
can make sense of it, it gives you an authoritative account of what
the underlying parser sees in your document.
There are several ways of parsing this output for yourself, should
you want to do that. For example, SGMLSpm
will parse this output format and allow
you to process SGML documents using Perl. The crucial thing in this
case is the final line in the output, which should be a single `C
'
command, indicating that the document conforms to its DTD.
If you want to try normalising your document, give the command
sgmlnorm sun1234.sgml
. This transforms your document into
an equivalent one with all omitted elements reinserted.
Try making parts of your document invalid, and comparing the error
with the error message nsgmls
produces.