XML

Summary

HTML has served its purpose well by allowing people to build web pages with relative ease, but its lack of structure is limiting when it comes to intelligently processing web content. For this reason, the architects of the Web focused significant efforts on charting the future of the Web with a more structured markup language for creating web pages. This markup language is XHTML, which is a reformulated version of HTML that meets the high structural and organizational standards of XML. XHTML is still in many ways a future technology in terms of becoming a standard used by all web developers, but it is nonetheless important to XML developers and HTML developers alike.

This tutorial introduced you to XHTML and then explored the relationship between HTML and XHTML. You learned about the origins of both languages and why XHTML has long-term benefits that make it an ideal successor to HTML. The tutorial shifted gears toward the practical by showing you how to create and validate XHTML documents. You then finished up the tutorial by learning how to migrate legacy HTML documents to XHTML.

Q&A

Q.

If web browsers don't know how to display XML documents, how is it that XHTML documents can be viewed in web browsers?

A.

XHTML represents the one exception to the rule about XML documents not being viewable without the aid of stylesheets. Because HTML documents are directly viewable in web browsers, even without the help of stylesheets, it only makes sense that XHTML documents should be viewable as well. However, you still must use stylesheets if you want control over the layout and formatting details of XHTML documents.

Q.

What happens if I don't validate my XHTML documents?

A.

Nothing happens, as least for now. Web browsers currently treat XHTML documents with the same leniency that they handle HTML documents, so you can get away with creating invalid documents if you want. However, this goes against the whole premise of XHTML, which is to demand the creation of highly accurate documents. The idea is that browsers and web-based applications may at some point validate XHTML documents. So you should make an effort to police your own documents and make sure they are valid before publishing them on the Web.