These documents provide a good background for a better understanding of SGML and XML.
A useful and simple document available in its original form at http://www-tei.uic.edu/orgs/tei/sgml/teip3sg/index.html.
A close look at the ins-and-outs of XML is available at http://nwalsh.com/docs/articles/xml/.