Previous | Table of Contents | Next |
SGMLS is the most commonly used public domain SGML validator available. It exists for almost every platform and was the first free parser to run on the Mac. The best place to get copies of SGMLS is the SGML FTP archives. The best place to learn more about updates and upgrades is the SGML newsgroups. There are other public domain parserssome of which are newer and better than SGMLSbut none has been ported to the Mac.
SGMLS is a stand-alone program. It reads a text file, a DTD, and (if necessary) an SGML declaration, and then it parses the document. To report the SGML errors that it finds, it uses error messages based directly on the ISO 8879 standard. Several versions of SGMLS for the Mac are available at the FTP sites. The earlier version, compiled using Think C, was slower and had a more difficult interface. The new version, described here, is compiled with Metrowerks and is available for PowerPC and 68K Macintoshes. It has added interface features that make it easier to use.
Note:
SGMLS is a program written for a command line interface, and it does not shake that paradigm, even though on the Mac it has dialog boxes and buttons. You actually have to type in information that on a Mac you would usually select with menus and dialog boxes.
Running SGMLS. The interface to SGMLS is an unadorned dialog box divided into three parts (see fig. 27.6). The top section contains a box where you type the name of the file that you want to validate and any switches that you want SGMLS to use. The lower-left section of the dialog box indicates input options, and the lower-right section indicates output options.
Fig. 27.6 SGMLS has a simple interface that mimics a command line.
To validate a file using SGML:
See DTDs and Declarations for Elements, Attributes, and Entities, p. 62
Common Problems with SGMLS. SGMLS has little documentation beyond a lengthy UNIX man page. It contains a large amount of technical information, most of which you do not need. However, you can obtain the names of the basic switches and parameters from it, if you need them. All implementations of SGMLS work the same, so the documentation applies to all platforms.
Command Line Switches. SGMLS assumes that you are using SGMLs standard defaults unless you specify otherwise. These defaults impose constraints that you might not like. Element names are restricted to eight characters, and literal values are restricted to 240 characters. If you want to change these values, you must edit the SGML declaration and then tell your SGML software which file contains the declaration. You can use a custom declaration by providing the name of the declaration file before the name of the SGML document.
See Attributes: Their Use and the ATTRIBUTE Declaration, p. 182
You can use other switches with SGMLS. For example, you can specify how you want error messages to be printed, which kinds of errors you want to know about, and how SGMLS should resolve Generic Public Identifiers.
Finding the Documents DTD and Other Referenced Files. Your document might give you an error message that sounds as though it does not recognize any elements or attributes. For example:
Error at file.sgm, line 11 accessing "file.dtd": SGML error at file.sgm, line 12 at record start: No definition for HELLO document type; "HELLO O O ANY" assumed
Previous | Table of Contents | Next |