An SGML-based parsing-validating engine will find 48 errors with this
file. Let us start by showing what the three samples for which I substituted
<PRE>
for <XMP>
in my calling page
for this HTML tag/element (this uses <XMP>
):
When passed through the validator each instance of the </B>
closing tag creates an error. This is because in a literal character
data portion of the document, an SGML parser turns off as much as it can,
such that it does not even see the opening <B>
tags,
but since it is looking for the closing </XMP>
tag it
must check all closing tags, and it does see them, and therefore each is
seen as an "end tag for element 'B' which is not open." One
can see that simply on the browser screen it looks just like the
<PRE>
sample with which I substituted it (this uses
<PRE>
):
St. <B>Pat</B>rick was a <B>gent</B>leman Who through <B>strat</B>egy & <B>stealth</B> Drove <B>all</B> the snakes from <B>Ir</B>eland, Here's a <B>toast</B>ing to his <B>health</B>; But <B>not</B> too many <B>toast</B>ings Lest you <B>lose</B> yourself & <B>then</B> For<B>get</B> the good St. <B>Pat</B>rick & see <B>all</B> those snakes a<B>gain</B>.
Notice that while there are 16 such errors in lines 14 through 21 (the
<XMP>
sample), there are no such errors in lines 33
through 40 (the corresponding lines in the <PRE>
sample).
So this file is already not valid HTML on account of the closing tags
within the <XMP>
above. The same follows for the next
of these three examples (this uses <XMP>
):
The two errors in the above sample (on lines 48 and 49) are the same
situation as before but this time with the <STRONG>
and
<EM>
tags for which again, only the closing tags are
detected. In the valid "Working XMP and LISTING Tag Element Examples"
file, we substituted that with (this uses <PRE>
):
The <STRONG> tag (ending with </STRONG>) is more emphatic than the <EM> tag (which ends with </EM>). Use the & character entity to place an ampersand in the text.
And again notice that there are no errors generated for lines 57 and 58
which used <PRE>
. The third case introduces some
different errors (this uses <XMP>
):
tag & the