3.5. XML Application: XHTML

A good place to study the use of links in the real world is HTML (Hypertext Markup Language), the language behind web pages. Hypertext is text with embedded links connecting related documents. It's helped the World Wide Web grow into the wildly successful communications medium it is today.

HTML provides a simple framework for generic documents displayed on screen. It contains a small set of elements that serve basic roles of structuring without many frills. There are head elements to provide titles (<h1>, <h2>, etc.), paragraphs (<p>), lists (<ul>, <ol>), tables (<table>), simple inline elements (<em>, <tt>) and so on. It isn't very detailed, but it's enough to get pages up on the screen for people to see.

We are going to examine a reformulation of HTML called XHTML. It's almost exactly the same as HTML Version 4, but with some restrictions that make it compatible with XML rules. Every XHTML page is a complete XML document that conforms to the XML Version 1.0 standard, and is compatible with all general-purpose XML tools and processors. XHTML documents are also compatible with most HTML browsers in use today, if you follow the guidelines we list below.

There are important benefits to using XHTML over regular HTML:

  • Because XHTML is an XML-conforming standard, XHTML documents can be used with any general-purpose XML editor, validator, browser, or other program designed to work on XML documents.

  • Documents that follow the stricter XML rules are cleaner, ...

Get Learning 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.