HTML and CSS Reference
In-Depth Information
16.2. Creating XHTML Documents
For the most part, creating an XHTML document is no different from cre-
ating an HTML document. Using your favorite text editor, simply add the
markup elements to your document's contents in the right order, and
display it using your favorite browser. To be strictly correct ("valid," as
they say at the W3C), your XHTML document needs a boilerplate declara-
tion upfront that specifies the DTD you used to create the document and
defines a namespace for the document.
16.2.1. Declaring Document Types
For an XHTML browser to correctly parse and display your XHTML docu-
ment, you should tell it which version of XML is being used to create the
document. You must also state which XHTML DTD defines the elements
in your document.
The XML version declaration uses a special XML processing directive. In
general, these XML directives begin with <? and end with ?> , but other-
wise they look like typical tags in your document. [*] To declare that you
are using XML version 1.0, place this directive in the first line in your
[*] <! was already taken.
<?xml version="1.0" encoding="UTF-8"?>
This tells the browser that you are using XML 1.0 along with the 8-bit
Unicode character set, the one most commonly used today. The encoding
attribute's value should reflect the character set used in your document.
Refer to the appropriate International Organization for Standardization
(ISO) standards for other encoding names.
Once you've gotten the important issue of the XML version squared away,
you should then declare the markup language's DTD:
Search WWH ::

Custom Search