Synook

The weirdness of SGML

Recently, I was browsing through the HTML 4.01 Strict DTD and some other material on SGML, and I was suprised to find just how … accepting HTML is. After some exploration, I discovered even the following document validates (all of it is shown).

<HEAD<TITLE>Test</> <BODY<P<IMG SRC=test.jpg ALT=validation> This document validates... somehow...

This uses the “obscure” feature of SGML-based languages known as SHORTTAGS – which means that if unambiguous enough tags don’t have to be closed, and if necessary they can be closed with </>, instead of stating the full name.

However, hardly any of us exploit these features, so, this is yet another reason to use XHTML – because we almost do so anyway, most of the time! Unless you need to save space, that is…