Re: [xml-dev] SGML default attributes.

From
Norman Gray <>
To
harvey <>
Date
2016-04-29T12:54:51Z
ID
<>
Thread
Re: [xml-dev] SGML default attributes.
Greetings.

On 29 Apr 2016, at 13:07, harvey wrote:

> The SGML standard required that the SGML instance validate against the 
> SGML declaration and SGML DTD.  The browsers downloaded the 
> declaration, DTD and instance, then  before the document could 
> displayed the browser also had to parse the document against the DTD.

It's slightly more fundamental than that.  In the XML world, the DTD is 
just for validation -- a 'well-formed' XML document will parse without 
error without any DTD (see the other current thread), but may or may not 
be valid.

An SGML DTD, on the other hand, specified rather more.  The 'prologue' 
(not strictly part of the DTD, but skip that) could change what tokens 
were recognised in the input stream (an SGML document isn't restricted 
to '<' and '>' for delimiting tags, for example, but could choose these 
on a document-by-document basis), and it had _extensive_ support for 
'tag minimisation'.

Thus (if I recall correctly; certainly it would be possible) I think 
there was an HTML-in-SGML DTD which allowed

     <p>Hello

to be a fully valid HTML document.  The DTD told the parser that the 'p' 
element contained text content, but was contained by a 'body' element, 
preceded by a 'head' element, and contained within a 'html' element.  
Thus the SGML parser would behave, in this case, indistinguishably from 
the document

     <html><head><title></title></head><body><p>Hello</p></body></html>

This defaulting, and various other minimisation techniques, were 
absolutely dependent on the DTD.

Best wishes,

Norman


-- 
Norman Gray  :  https://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK