Question

I have well formed HTML files. To turn them into SGML do I just switch the extension or is there more to do?

Was it helpful?

Solution

It's going to depend on what version of HTML. From SGML:

While HTML was developed partially independently and in parallel with SGML, its creator Tim Berners-Lee, intended it to be an application of SGML. The design of HTML (Hyper Text Markup Language) was therefore inspired by SGML tagging, but, since no clear expansion and parsing guidelines were established, most actual HTML documents are not valid SGML documents. Later, HTML was reformulated (version 2.0) to be more of an SGML application, however, the HTML markup language has many legacy- and exception- handling features that differ from SGML's requirements. HTML 4 is an SGML application that fully conforms to ISO 8879 – SGML.

The charter for the recently revived World Wide Web Consortium HTML Working Group says, "the Group will not assume that an SGML parser is used for 'classic HTML'". Although HTML syntax closely resembles SGML syntax with the default reference concrete syntax, HTML5 abandons any attempt to define HTML as an SGML application, explicitly defining its own parsing rules which more closely match existing implementations and documents. (It does, however, define an alternative XML-based XHTML serialization, which does conform to SGML (WWW).)

So it looks like you probably already have SGML if you have well-formed HTML 4 or XHTML. Anything earlier (unlikely) or later (HTML 5) and you may have to make some changes to the document itself.

OTHER TIPS

It is enough to change extension, but in fact you do not have to do anything to have SGML from HTML because HTML is fully based on SGML, so whan you have HTML you already have SGML.

SGML is mother of markup. XML is also based on SGML. So when you have some XML, you automatically have SGML. XHTML is based on XML, so when you have XHTML, you have XML and SGML.

An HTML document that validates is an SGML document. Whether this has any practical impact is a different issue, but such a document can be processed using general SGML tools (which still exist).

Validity is not required, however, for being SGML. And SGML document need not have a document type declaration at all. But if it does and if it validates, then this proves that it is indeed SGML (and not just SGML-like), since SGML validators check the basic syntax too, in addition to checking conformance to the DTD.

There is no well-formedness concept in SGML or in SGML-based HTML, but the XML well-formedness concept just means that the document is XML (and not just XML-like) in the first place, i.e. uses the general syntax of XML correctly.

As long as your HTML validates to one of the SGML HTML DTDs, you already have SGML.

Contrary to other answers, XML/XHTML is not valid SGML.

Also with SGML there isn't really such a thing as "well-formed" SGML, only valid (to a DTD) SGML.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top