This question is equivalent to : "What are the advantages and disadvantages to use SGML over XML, and XML over SGML ?".
I already know several similarities and differences between SGML and XML, but they don't answer this question.
SIMILARITIES
- SGML and XML both allow us to describe documents (structure, data, metadata) ;
- Both separate the appearence (colors, etc.) from data/structure/metadata ;
- Both SGML and XML can be used in Web pages/in Web (even if XML is more specialized in Web than SGML)
- SGML and XML documents must contain a DTD to be "VALID"
DIFFERENCES
- SGML provides several ways to write things (e.g. : we can write empty and non-closed tags, we can write
<foo>d</>
, etc.) - SGML documents can be very hard to write
- Thus, SGML documents' parsing can be very low and complexe
- XML is a subset of SGML that is more simple to learn, to use
- XML doesn't allow to write things in several ways contrary to SGML (e.g. : empty and non-closed tags are NOT allowed)
- Thus, XML's parsing is simpler and faster than SGML's one
- SGML documents have not status "WELL FORMED", XML ones do. (and have this status if there syntaxe is correct)
- SGML documents must contain a DTD : not XML ones.
BUT THE QUESTION REMAINS
What are the advantages and disadvantages of SGML/XML (ie. : when to use one of them and not the other ?) ?
The difference is that all the world uses XML and there's vast amounts of software for it, whereas SGML is used only by a small high priesthood and has very little software available.
Technical differences in such a situation are largely irrelevant.