SGML is a meta language. It does not specify how to markup any given document. It allows for application and platform independence. It is portable. Sharing and re-packaging of information is possible.
SGML is very complex and expensive to implement and maintain. The software used to support SGML is expensive and complex. It has no mainstream browser support. Because of its complexity, it is not WEB friendly.
Extensible Markup Language (XML) was developed to overcome these limitations and help foster the burgeoning Internet. SGML was used as the foundation or starting point in the development, but it is incorrect to label XML as a child of SGML. Like SGML, XML is a meta language. It allows implementers the flexibility to articulate their own markup strategy. By comparison, HTML is a specific application and resulting implementation of SGML. HTML is a published, supported DTD. HTML could be labeled a child of SGML, but “application” or “implementation” is a better descriptor of SGML and XML DTD’s.
XML is a World Wide Web Consortium (W3C) Recommendation REC-XML-19980210 (www.w3c.org.) No DTD or schema is required, but can be designed and used in conjunction with XML document instances. Content and context tags are possible. XML can make use of style sheets. It does not have all of the features and complexity of SGML and, thus, is easier to support and easier to share XML document instances in a networked world. XML has become a family of recommendations and initiatives.
XML document instances can be generated and used without benefit of a DTD or schema. This can happen if the document instance is “well-formed.” An XML document instance is “well-formed” if it adheres to XML syntax. The document instance must have an XML declaration. XML syntax requires that each document instance has a root, or document, tag that immediately follows the XML declaration. It can be used only once and must close the document instance. All tags are closed and properly nested.
Both examples above are well-formed. They start with an XML declaration. The root, or document, tag is <StartDay></StartDay> for our coffee document and <DOC></DOC> for the sports article. Be aware that XML is case sensitive regarding element tags. Using <StartDay> and </Startday> would result in a parsing error. The parser would report that the document was not well-formed because the element, <StartDay>, was not closed, that is, it had no end-tag, </StartDay>. All tags must be closed.