Math 300: XHTML (back to Math 300 notes)

As a case study of XML in action, let's look at XHTML, the extensible HyperText Markup Language. This is, on its face, a simple rendering of HTML in XML format. Each HTML tag is mapped to an XML tag of the same name, all with their meanings interpreted by a DTD. Some formatting of an XHTML file is obtained through the namespace, but you can specify more formatting via a stylesheet, usually CSS.

Following is a typical XHTML declaration, as it must appear at the top of an XHTML file.

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "" [ <!ENTITY mathml ""> ]>
<html xmlns="">

The first line just tells your browser that XML is coming. The next tells where to get the DTD for this document. Note that the DTD is somewhere far away on a W3C server. Finally comes a line that tells your browser where the meaning of all the tags used lies: it is in a so-called namespace. This allows us to use short names for these tags - everything is understood to be in the context of the namespace.

From our point of view, there are relatively few differences between XHTML and plain old HTML.