XML Name spaces, XHTML, XHTML validation

XML namespaces

If you only are using your own Document Type Definition file, you probably do not need to use namespaces.

Sometimes you may use more than one Document Type Defintion.

For example, you might wish to use two DTDs that have specified a phone element. You can use namespaces to say which one you wish to use. The two different uses of phone element can be managed if they are in different namespaces.

Unfortinuatly, Document Type Definitions do not support local names for namespaces. The lack of local names limits how namespaces can be used. The link at the left goes to a discussion of the limited way in which Document Type Definitions can be used to provide some support for namespaces.

XHTML document type

XML declaration

When you write an XHTML page, the first line should be the XML declaration. I suggest you use:
<?xml version="1.0" encoding="UTF-8"?>
Most current browsers will work without the XML declaration. We are studying XML, so you should use it, even if sometimes it is not essential.
It specifies we are using XML version 1. You need to specify an encoding; I recommend UTF-8
The XML declaration must be the FIRST line in the document. Do NOT put a blank line or comment before the XML declaration.

XHTML DOCTYPE declaration

The next line must be the DOCTYPE tag, to specify XHTML. Again, do NOT put a blank line or comment before the XHTML DOCTYPE declaration.
DOCTYPE tags were discussed in week 2.

There are two very commonly used DOCTYPE tags used for XHTML. One is for standard strict XHTML; it does not allow deprecated elements and attributes that are being phased out. The second is for standard transitional XHTML; it allows deprecated elements and attributes. The text lists some additional DOCTYPE tags.
I have been using transitional, but am changing to strict for most of my new pages.

The strict DOCTYPE is:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            

The transitional DOCTYPE is:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            

Differences between HTML and XHTM

The link to the left goes to a short list of the differences between HTML and XHTML. These differences are because XHTML must be HTML and also XML.

Reading assignment

Reading assignments are in Beginning XML, by DavidHunter, et al.
Read the chapters.

Chapter 3: XML Namespaces

Chapter 18: XHTML

You may also wish to refer to a book on XHTML. If you do not have a good one, I suggest:
HTML, XHTML, & CSS by Elizabeth Castro