Well Formed XML Documents
A well formed document ensures the tags do not overlap and has closing tags
for each open tag.
Overlapping Tags
XML has a strict hierarchical syntax. Tags must be nested properly by closing
all child elements before closing the parent elements. The following is an
example of an overlapping tag in HTML.
An Incorrect HML Document with Overlapping Tags
<u><b>This is underlined and BOLD</u></b>
As the bold tag is started within the underline tag, it should be closed before
the underline tag. Browsers are able to render the above line so that it displays
correctly, but this would be illegal in XML as it doesn't adhere to the strict
hierarchical syntax.
Corrected Example
<u><b>This is underlined and BOLD</b></u>
SGML doesn't require closing tags, but XML does to ensure the well-formedness
of the document. Some HTML tags don't have closing tags. To adhere to the rules
of XML, an XHTML document works around the problem by placing a '/' at the
end of the tag.
<img src="images/logo.gif" alt="Logo" width="100" height="50" />
Case Sensitive
XML is case sensitive. XHTML, the XML version of HTML is defined in lowercase.
All tags and attributes should be declared in lowercase.
Quotes
Attribute values should always be placed in single or double quotes, regardless
of the data type, as in the following example.
<table border="0" cellpadding="0" cellspacing="0">