DOM - HTML vs XML document

> (World Wide) Web - (W3|WWW) > The Document Object Model W3C API Interface (DOM)

1 - About

The DOM specification gives the distinction between this two type of document:

3 - Properties

3.1 - 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"?>
   <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.

In HTML, on the other hand, headings do not contain the body of a section.

   <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>

3.2 - Level

HTML goes down only to five levels.