HTML and CSS Reference
In-Depth Information
To insert a DOCTYPE declaration:
1. In your text editor, open the dtd_list.txt file from the tutorial.09\tutorial folder
included with your Data Files.
2. Copy the DOCTYPE declaration for the XHTML 1.0 transitional DTD—the fourth
DTD from the bottom of the file.
Make sure you copy the
text of the DTD exactly.
3. Close the file, and then return to the works.htm file in your text editor.
4. Directly after the XML prolog, paste the copied DOCTYPE declaration. Figure 9-12
highlights the revised code in the file.
figure 9-12
insert the DOctYPe declaration
5. Save your changes to the file.
Setting the XHTML Namespace
As noted earlier, XHTML is only one of hundreds of XML vocabularies. In some situa-
tions, a document author may want to combine elements and attributes from different
vocabularies in the same document. For example, a mathematician might want to com-
bine features of the MathML vocabulary with features from XHTML in a single com-
pound document. Each element or attribute that belongs to a particular language is part
of that language's namespace . There are two types of namespaces: default and local. For
now, you'll focus only on the default namespace. A default namespace is the namespace
that is assumed to be applied, by default, to any element or attribute in the document. To
declare a default namespace, you add the xmlns (XML namespace) attribute
< root ƒxmlns=” namespace ”>
to the markup tag for the document's root element, where root is the name of the root
element and namespace is the namespace id. Every XML vocabulary has a unique
namespace id. For example, if you wish to declare that the elements in your document
belong to the XHTML namespace by default, you add the following attribute to the open-
ing <html> tag:
<htmlƒxmlns=” http://www.w3.org/1999/xhtml”>
The namespace id for XHTML looks like a URL, but it's not treated as one by XML
parsers. The id can actually be any string of characters as long as it uniquely identifies the
document namespace. For XHTML, it was decided to use http://www.w3.org/1999/
xhtml as the unique identifier.
There is no syntax for
declaring namespaces
in HTML5.
 
Search WWH ::




Custom Search