XHTML document structure
An XHTML document consists of three main parts:
The basic document structure is:
<head> area contains information about the document, such as ownership, copyright, and keywords; and the
<body> area contains the content of the document to be displayed.
Listing 1 shows you how this structure might be used in practice:Listing 1. An XHTML example
Line 1: Since XHTML is HTML expressed in an XML document, it must include the initial XML declaration
<?xml version="1.0"?> at the top of the document.
Line 2: XHTML documents must be identified by one of three standard sets of rules. These rules are stored in a separate document called a Document Type Declaration (DTD), and are utilized to validate the accuracy of the XHTML document structure. The purpose of a DTD is to describe, in precise terms, the language and syntax allowed in XHTML.
Line 3: The second tag in an XHTML document must include the opening <html> tag with the XML namespace identified by the
attribute. The XML namespace identifies the range of tags used by the
XHTML document. It is used to ensure that names used by one DTD don't
conflict with user-defined tags or tags defined in other DTDs.
Line 4: XHTML documents must include a full header area. This area contains the opening
<head> tag and the title tags (
<title></title>), and is then completed with the closing
Line 5: XHTML documents must include opening and closing
tags. Within these tags you can place your traditional HTML coding
tags. To be XHTML conformant, the coding of these tags must be
Line 6: Finally, the XHTML document is completed with the closing