XML is eXtensible Markup Language is a markup language developed by W3C(World Wide Web Consortium).
It defines a set of rules that are self descriptive.
It is designed to store and transport information or data which is wrapped in non-predefined tags unlike HTML which has predefined tags. The author of XML has to define the tags and document structure.
XML separates data from presentation. That is, it carries the data but does not carry any information about how to display it. The formatting and displaying is taken care of by HTML. A typical XML document is tree structure that starts with a root and branches to leaves. XML has syntax rules and any XML document that conforms to these syntax rules is said to be “Well Formed” XML document.
XHTML stands for eXtensible HyperText Markup Language. It is almost similar to HTML but more stricter than HTML. XHTML is developed by combining HTML and XML. Where is it strict?
- XHTML DOCTYPE is mandatory
- XHTML document must have one root element
- <html>, <head>, <title>, and <body> are mandatory
- XHTML elements must be in lowercase, properly nested and closed
SGML stands for Standard Generalized Markup Language is a standard for specifying a document markup language or tag set. Such a specification is called Document Type Definition(DTD). Therefore, it is not considered language in itself but a metadata.
SGML was derived from GML (Generalized Markup Language), which allowed users to work on standardized formatting styles for electronic documents. Apparently HTML and XML use SGML principles. Meaning, SGML is a superset of HTML and XML.