HTML and CSS Reference
In-Depth Information
Defining a Default Namespace
• To define a default namespace for an XML document, add the attribute
< root ƒxmlns=” namespace ”>
to the document's root element, where root is the name of the root element and
namespace is the namespace id for the default namespace.
• To set the default namespace for an XHTML document, add the following xmlns attri-
bute to the html element:
<htmlƒxmlns=” http://www.w3.org/1999/xhtml”>
If you don't intend to combine different XML-based languages within the same docu-
ment, it's still a good idea to add a namespace to an XHTML file to explicitly identify the
XML vocabulary in use. In practical terms, though, an XHTML document is still interpre-
table by most browsers without a namespace. Tom would like you to add the XHTML
default namespace to his works.htm file.
To add the XHTML namespace:
1. Locate the opening <html> tag in the works.htm file.
2. Within the tag, insert the following attribute, as shown in Figure 9-13:
xmlns=” http://www.w3.org/1999/xhtml”
figure 9-13
Declaring the XHtML namespace
3. Save your changes to the file.
Search WWH ::




Custom Search