Intro
If you follow the development of the Web you might have heard of the XHTML specification. XHTML is the successor of HTML and as the name implies it is based on XML. The first XHTML specification doesn't change a lot, there are only very few adjustments to port a good HTML 4 document to XHTML. In this article I'm going to tell you what changed and I'm also going to write about the pros and cons of XHTML.
What changed?
As stated above, the first XHTML spec. doesn't change much. The changes are limited on achieving XML compliance. There weren't any tags added or removed.
- every tag must be closed
- tags are in lower case
- attributes must be quoted
- for more changes see the specification
- because of all this, every XHTML page is also a perfectly valid XML document.
The good
There are really some advantages with this new approach. What I like most is that it's possible to parse XHTML documents with an XML parser. Because of this it's a lot easier to write software which processes Web documents. You can also edit XHTML documents with any XML editor out there.
There isn't really much more good about XHTML. This has to do with the fact that I'm comparing with HTML 4, and XHTML 1.0 does just minor changes to HTML. Comparing with non-compliant HTML, there is much more. I have written about this in my article "Why care about standards".
The bad
Because there are so few changes, it's very easy to port compliant HTML 4 to XHTML. When I ported my Web site to XHTML, I used a small sed script to rewrite most of the stuff. But most Web sites aren't compliant to the HTML 4 standard. Then this step is far more complicated. In fact you will most probably need to do the majority of the work manually. Most sites would need a complete rewrite with a combination of XHTML and CSS.
Some browsers also have problems with XHTML code. This is because every tags needs to be closed, even the simple <br>-tag. This tag must be rewritten as <br />. Some browsers get problems with this form. Ok, I haven't really seen a browser with this problem myself. The newer browsers do fine with it. So far I have seen the current Mozilla, Opera and Internet Explorer browsers rendering this tag without problems.
Conclusion
The conclusion of this short article is that I would not recommend to move to XHTML for existing sites. It doesn't serve you much. But for new Web presences I highly recommend developing as standard compliant as possible. Be it HTML 4 or XHTML, this really doesn't matter much. I recommend you to read Why care about standards for more information about all this.