About
The DOM specification gives the distinction between this two type of document:
- XML documents (ie XHTML)
- and HTML documents.
Properties
Nested
HTML elements are rarely nested.
In a XML file, the subsection (SECT) can be totally contained within the major section (SECT). They are nested.
<?xml version="1.0"?>
<ARTICLE>
<TITLE>A Sample Article</TITLE>
<SECT>The First Major Section
<PARA>This section will introduce a subsection.</PARA>
<SECT>The Subsection Heading
<PARA>This is the text of the subsection.
</PARA>
</SECT>
</SECT>
</ARTICLE>
In HTML, on the other hand, headings do not contain the body of a section.
<BODY>
<H1>The First Major Section</H1>
<P>This section will introduce a subsection.</P>
<H2>The Subsection Heading</H2>
<P>This is the text of the subsection.</P>
</BODY>
Level
HTML goes down only to five levels.
Strictness
The following are not valid in XML/XHTML
- Non closing tag
<!-- valid HTML, non XML valid -->
<meta name="generator" content="datacadamia">
<!-- valid XHTML -->
<meta name="generator" content="datacadamia"/>