VII.2. HTML Syntax Specification (HSS) files

As part of the browser compatibility testing portion of Bobby, the HTML elements, their attributes, and their attributes assigned values, are compared against the legal values for these items for select web browsers. This helps a person know if, for example, the IMG ALIGN attribute is not supported on Lynx whereas it might be supported under Netscape. To store this information in an easily readable and modifiable format, I created a simple parser that reads a language much like an SGML DTD, though less complicated and ultimately less rich. This language is called the HTML Syntax Specification (HSS). For example, consider the following snippet from the HTML 4.0 HSS file:
# HTML 4.0 -- HSS file Created 1/1/97

<!TITLE "HTML 4.0">

....

<IMG
    ID:0 {$CDATA}
    CLASS:0 {$CDATA}
    STYLE:0 {$CDATA}
    TITLE:0 {$CDATA}
    LANG:0 {$CDATA}
    DIR:0 {LTR RTL}
    ONCLICK:0 {$CDATA}
    ONDBLCLICK:0 {$CDATA}
    ONMOUSEDOWN:0 {$CDATA}
    ONMOUSEUP:0 {$CDATA}
    ONMOUSEOVER:0 {$CDATA}
    ONMOUSEMOVE:0 {$CDATA}
    ONMOUSEOUT:0 {$CDATA}
    ONKEYPRESS:0 {$CDATA}
    ONKEYDOWN:0 {$CDATA}
    ONKEYUP:0 {$CDATA}
    SRC:1 {$CDATA}
    ALT:1 {$CDATA}
    LONGDESC:0 {$CDATA}
    HEIGHT:0 {$LENGTH}
    WIDTH:0 {$LENGTH}
    USEMAP:0 {$CDATA}
    ISMAP:0 {}
    ALIGN:0 { TOP MIDDLE BOTTOM LEFT RIGHT }
    BORDER:0 {$LENGTH}
    HSPACE:0 {$INT}
    VSPACE:0 {$INT}
>

Every HSS file must start with a TITLE declaration. Comments can be interspersed anywhere and are denoted by a line starting with a # sign. In the example above, the IMG element has a variety of attributes which can follow it. If an attribute is followed by a ":1" that means that it can not be omitted. After each attribute, inside the { and } symbols are a list of possible values that the attribute may be assigned. For example for the ALIGN attribute, acceptable values are: TOP, MIDDLE, BOTTOM, LEFT, and RIGHT. For those attributes that can take any value use $CDATA. For those that can take integers, use $INT. For those that take percentages or integers use $LENGTH (this is currently unimplemented though) and for those that can take colors, use $COLOR.

An HSS file is made up of a collection of such HTML element definitions.