Re: space

Peter Flynn <pflynn@curia.ucc.ie> wrote:

> Parsing the file
>
> 	<!doctype html system "html3.dtd">
> 	<html><head><title>Test</title></head><body>
> 	<pre>
> 	PROCEDURE frob
> 	BEGIN
> 	  IF silly <> foolish THEN
> 	    WRITELN("Oooops.");
> 	END
> 	</pre></body></html>
>
> produces the following from sgmls:
>
> 	sgmls: SGML error at test.html, line 6 at ">":
> 	       PRE end-tag implied by short start-tag (no GI); not minimizable
>
> In other words, because PRE allows markup within it, any "<" in PRE is
> expected to be the start of a valid element, and thus to be followed by
> [-\.a-zA-Z]+

Not exactly...  "<" is a delimiter-in-context, which means
that it's only recognized as markup when it's followed by
certain other things.  In this case, one of the things that
can follow it is the TAGC delimiter ">".  (The sequence "<>"
is an "empty start-tag".  Don't ask...)

Constructs like:

	<pre>
	    if x <= y & x < z
	</pre>

will pass through an SGML parser without an error
(though it's no doubt a better idea to type


	<pre>
	    if x &lt;= y &amp; x < z
	</pre>

instead, if for no other reason than it's easier
to remember to always use &lt; than to remember
all of SGML's delimiter recognition rules.)



--Joe English

  joe@art.com

Received on Tuesday, 24 September 1996 17:36:41 UTC