I’ve used some elements of XHTML (eXtensible Hypertext Markup
Language) already in this book, although you may not have realized it.
For example, instead of the simple HTML tag
<br>, I’ve been using the XHTML
<br /> version. But what’s the
difference between the two markup languages?
Well, not a lot at first glance, but XHTML improves on HTML by clearing up a lot of little inconsistencies that make it hard to process. HTML requires quite a complex and very lenient parser, whereas XHTML, which uses standard syntax more like XML (eXtensible Markup Language), is very easily processed with quite a simple parser—a parser being a piece of code that processes tags and commands and works out what they mean.
XHTML documents can be quickly processed by any program that can handle XML files. As more and more devices such as iPhones and BlackBerries become web-enabled, it is increasingly important to ensure that web content looks good on them as well as on a computer’s web browser. The tighter syntax required by XHTML is a big factor in helping this cross-platform compatibility.
So what is happening right now is that browser developers, in order to be able to provide faster and more powerful programs, are trying to push web developers over to using XHTML, and the time may eventually come when HTML is superseded by XHTML—so it’s a good idea to start using it now.
The XHTML standard is constantly evolving, and there are a few versions in use: