Extending XHTML 1.0

One of the attractions of XHTML is that you can extend it with your own elements because it's based on XML. The way you actually do this is has changed in the various XHTML working drafts over time; the current working draft on this topic is at http://www.w3.org/TR/xhtml-building/.

Here's an example. As you know, XHTML documents have <head> and <body> elements. Here, I'll add a <foot> element to XHTML 1.0. The W3C says that all custom XHTML elements should have their own namespace, so I'll give that element the namespace doc. I'll also create an attribute for this element, footattribute, like this in a new DTD, extend.dtd:

<!ELEMENT doc:foot (#PCDATA) >
<!ATTLIST doc:foot
     footattribute    CDATA   #IMPLIED
>
    .
    .
    .

You also must ...

Get Inside XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.