XHTML 1.0: Where XML and HTML meet (1/8) - exploring XML
XHTML 1.0: Where XML and HTML meet
What is it?
The XHTML family is a reformulation of HTML 4 in XML. It represents the next step in the evolution of the Internet. It lets you enter the XML world, creating content that is both backward and future compatible. XHTML became an official W3C recommendation on January 26, so when you read this you are on the cutting edge of it all.
- Benefits and transition path
- Old HTML sins to overcome
- Old HTML sins (continued)
- Backwards compatibility to HTML
- Transition pains from HTML to XHTML
- Modularization of XHTML
- Extension Modules
- Document Profiles and Conclusion
Why all this? What is the problem with good old HTML?
We explored the shortcomings of HTML a while ago, in a nutshell:
- HTML has a fixed set of elements, so it is not easily extended to different needs
- HTML was designed with the PC in mind, not taking into account the multitude of alternative platforms coming to the Web, like TVs, mobile phones and digital tablets.
- HTML is defined relatively sloppily, requiring parsers to be quite forgiving and intelligent in fixing problematic markup on the fly. This intelligence weighs in heavy on your hard disk with your favorite browser.
So what is there to gain?
Citing the W3C recommendation on XHTML (in rearranged order of my humbly perceived importance):
- "Document developers and user agent designers are constantly discovering new ways to express their ideas through new markup. In XML, it is relatively easy to introduce new elements or additional element attributes. The XHTML family is designed to accommodate these extensions through XHTML modules and techniques for developing new XHTML-conforming modules (described in the forthcoming XHTML Modularization specification). These modules will permit the combination of existing and new feature sets when developing content and when designing new user agents.
- Alternate ways of accessing the Internet are constantly being introduced. Some estimates indicate that by the year 2002, 75% of Internet document viewing will be carried out on these alternate platforms. The XHTML family is designed with general user agent interoperability in mind. Through a new user agent and document profiling mechanism, servers, proxies, and user agents will be able to perform best effort content transformation. Ultimately, it will be possible to develop XHTML-conforming content that is usable by any XHTML-conforming user agent.
- XHTML documents conform to the XML standard, so they are readily viewed, edited, and validated with standard XML tools.
- XHTML documents can still be written to operate as well or better than they did before in existing HTML 4-conforming user agents as well as in new, XHTML 1.0 conforming user agents.
- XHTML documents can utilize applications (e.g. scripts and applets) that rely upon either the HTML Document Object Model or the XML Document Object Model [DOM].
How do HTML documents become XHTML?
An XHTML document must:
- validate against one of the three DTDs.
- start with the root element <html>.
- refer to the XHTML namespace http://www.w3.org/1999/xhtml in its root element.
- contain one of the following DOCTYPE declaration prior to the root element:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "DTD/xhtml1-frameset.dtd">
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>My first XHTML page</title> </head> <body> <p>Hello XHTML world!</p> </body> </html>
Created: Feb. 07, 2000
Revised: Feb. 07, 2000