SGML is a markup language for structured documents. Being the foundation for
HTML, SGML today is the most frequently used language for structuring documents. The rules for how documents of a certain type may be structured are specified in a
DTD, and every application of SGML (such as
HTML) defines such a
DTD. Even though SGML has been very successful, it is also rather complex and contains a lot of obscure features which are rarely used (and implemented). Thus, when a new language for replacing
HTML on the
WWW was needed, rather than directly taking SGML, a functional subset of SGML was defined, which has become known under the name of
XML.