SGML wierdness #743 [Was: Toward Closure on HTML ]

"Daniel W. Connolly" <connolly@hal.com>
Errors-To: listmaster@www0.cern.ch
Date: Fri, 8 Apr 1994 00:01:05 --100
Message-id: <9404072148.AA21634@ulua.hal.com>
Errors-To: listmaster@www0.cern.ch
Reply-To: connolly@hal.com
Originator: www-talk@info.cern.ch
Sender: www-talk@www0.cern.ch
Precedence: bulk
From: "Daniel W. Connolly" <connolly@hal.com>
To: Multiple recipients of list <www-talk@www0.cern.ch>
Subject: SGML wierdness #743 [Was: Toward Closure on HTML ]
X-Listprocessor-Version: 6.0c -- ListProcessor by Anastasios Kotsikonas
Content-Type: text/plain; charset="us-ascii"
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0
Mime-Version: 1.0
Content-Length: 1625
In message <9404072310.AA5107@notes.notes>, Matt Timmermans/MSL writes:
>
>Given these conditions, if the DTD were to be rewritten to use 'p' elements as
> 
>containers instead of divisions, it would be possible to specify BOTH the star
>t 
>and end tags as omissible.
>
>When parsing current HTML documents with the new DTD, an SGML parser would 
>usually infer the initial <p>, and infer a </p> before each explicit <p>.

Try it. It just doesn't work that way. An SGML parser can only infer
required start tags.

[This should be in a SGML FAQ or some such...]

connolly@ulua {** NONE **}../html-test[4416] cat test.sgml
<!DOCTYPE TEST [
<!ELEMENT TEST O O (HEAD, BODY)>
<!ELEMENT HEAD O O (TITLE)>
<!ELEMENT TITLE - - (#PCDATA)>
<!ELEMENT BODY O O (P | H1)*>
<!ELEMENT H1 - - (#PCDATA)>
<!ELEMENT P O O (#PCDATA)>
]>
<TITLE>testing</TITLE>
<H1>Here we go...</H1>
This causes problems.
<p>This would be fine
<p>And so would this.


connolly@ulua {** NONE **}../html-test[4417] sgmls -s test.sgml
sgmls: SGML error at test.sgml, line 11 at ".":
       Out-of-context data ended TEST document element (and parse)


Take out the "problems" line, and it's fine:


connolly@ulua {** NONE **}../html-test[4420] cat test.sgml
<!DOCTYPE TEST [
<!ELEMENT TEST O O (HEAD, BODY)>
<!ELEMENT HEAD O O (TITLE)>
<!ELEMENT TITLE - - (#PCDATA)>
<!ELEMENT BODY O O (P | H1)*>
<!ELEMENT H1 - - (#PCDATA)>
<!ELEMENT P O O (#PCDATA)>
]>
<TITLE>testing</TITLE>
<H1>Here we go...</H1>
<p>This would be fine
<p>And so would this.


connolly@ulua {** NONE **}../html-test[4421] sgmls -s test.sgml
connolly@ulua {** NONE **}../html-test[4422] 

Dan