sgmls  ☑

Derived from ARC SGML, the parser was rewritten as part of the Jade DSSSL processor (now OpenJade). This is a standalone (commandline) parser with options (among others) for:

sgmls is also used by the sgmlnorm normalizer to expand SGML shortcuts; and by the Emacs/psgml editor for validation. The 32–bit Windows binaries used in this test were installed from the SGML’97 CD-ROM.

C:\SGMLS\> sgmls -s sgml.dec recipe.sgml
	

In the case of this, and most command-line parsers, a null return means no errors were found in the DTD or document.

The companion sgmlnorm utility was also exercised: the normalization fills in all the missing parts of the SGML document by applying the rules from the SGML Declaration on what end-tags may be omitted and if attributes may be minimized (and much else). In this case the following output was obtained:

C:\Documents\> sgmlnorm sgml.dec recipe.sgml
<RECIPE>
<TITLE>Chocolate fudge</TITLE>
<COMMENT>My mother's recipe</COMMENT>
<INGREDIENTS>
<INGREDIENT QUANT="1" UNITS="LB">sugar
    </INGREDIENT>
<INGREDIENT QUANT="4" UNITS="OZ">chocolate
    </INGREDIENT>
<INGREDIENT QUANT="?" UNITS="PT">cream
    </INGREDIENT>
<INGREDIENT QUANT="1" UNITS="OZ">butter
  </INGREDIENT>
</INGREDIENTS>
<METHOD>
<LIST>
<ITEM>Mix the ingredients in a pan
      </ITEM>
<ITEM>Heat to 234?F, stirring constantly
      </ITEM>
<ITEM>Pour into greased flat tin
      </ITEM>
<ITEM>Allow to cool before cutting
    </ITEM>
</LIST>
</METHOD>
<SOURCE>Adapted from the Good Housekeepings cookbook</SOURCE>
</RECIPE>
	  

Note that by default, SGML is case-insensitive, and that the pretty-print indentation of the original document means that normalizing the omitted end-tags has introduced a white-space node into the character data content of the ingredient and item elements.