XML and the Wireless Web

The wireless web has undergone a lot of changes, some of which affect XML's role in developing mobile content. For this reason, it's important to understand how the wireless web has evolved to where it is today, and what ramifications this evolution has for mobile XML content developers.

Back in Tutorial 21, "Adding Structure to the Web with XHTML," you learned how XHTML was created as a new and improved HTML that adheres to the more rigorous syntax of XML. In version 1.1 of XHTML, the features were modularized so that features could be selectively added and removed to accommodate different applications. XHTML Basic is one of these modularized versions of XHTML, and its focus is on supporting a limited set of features that are uniquely suited to mobile devices. For example, frames are not supported in XHTML Basic. XHTML Basic doesn't solve all of the mobile issues, however, so a profile was built on top of XHTML Basic called XHTML Mobile. Its job was to fill in some of the gaps in XHTML Basic. As an example, XHTML Mobile adds support for some presentation elements not found in XHTML Basic, as well as stylesheet support. XHTML Mobile is the standard markup language for WAP (Wireless Application Protocol) 2.0, which is the latest mobile industry standard for the wireless web. But let's back up for just a moment.

Mobile devices include any handheld or easily portable technologycell phones, pagers, connected organizers, handheld PCs, and potentially others.

Before XHTML Mobile came along there were two primary mobile web services, WAP and iMode. iMode was created by NTTDoCoMo, and is popular in Japan and parts of Europe. WAP was created by a group of mobile industry leaders, and is the predominant standard for serving up mobile content worldwide. This version of WAP is known as WAP 1.0, and has taken a fair amount of criticism despite its success. WAP 1.0 and iMode rely on their own markup languages for coding pages served on each. More specifically, WAP 1.0 is based on WML (Wireless Markup Language) and iMode is based on cHTML (Compact HTML). These languages have both worked as basic markup languages for mobile web pages but they are lacking in many ways as we move to a more powerful XML-based wireless web.

Many of the core features in WML and cHTML converged in XHTML Mobile. A few of the WML-specific features, such as its card/deck user interface metaphor (more in this in a moment), were added to XHTML Mobile to form yet another language called WML2. WML2 represents the most complete XML-based mobile markup language for the wireless web but it isn't widely supported yet. Most current mobile browsers do support XHTML Mobile and regular WML (WML1). For this reason, a combination of WML1 and XHTML Mobile is the best bet for mobile web development.

Let's summarize the XML-related languages that enter the picture with the wireless web:

  • WML1Widely supported, based on WAP 1.0

  • cHTMLWidely supported internationally, based on iMode

  • XHTML MobileRapidly gaining support, based on WAP 2.0

  • WML2Very little support, considered an extension to WAP 2.0

Because I've tipped my hand that WML and XHTML Mobile represent the current approach for mobile web development, it's worth taking a closer look at those two technologies individually. As a mobile alternative to HTML, WML addresses the issues of limited bandwidth and limited screen real estate, which are common limitations of wireless devices. Wireless connections are typically slow, and the display space accommodates a relatively small number of text characters depending on the device and sometimes 1-bit (straight black-and-white) monochrome graphics. WML documents are extremely simple, created with a small selection of tags. WML's deck-and-card metaphor subdivides a WML document envisioned as a "deck"into components"cards." This allows the document to be transmitted all at once (if desired, and space allowing), without the need for the browser to display it all at once. However, it's ultimately up to the specific browser as to how a WML document is downloaded.

Although XHTML Mobile doesn't support many of the presentation features of WML, such as the card/deck user interface, it does support the use of CSS. Technically, WAP 2.0 represents the combination of XHTML Mobile and CSS. CSS provides a great deal of control over the formatting and display of XML content. When I refer to CSS as it applies to XHTML Mobile, I'm actually referring to a subset of CSS known as WCSS (Wireless CSS), which is somewhat of a scaled down CSS. In other words, WCSS is to XHTML Mobile what CSS is to XHTML.

The good news in regard to XHTML Mobile and WAP is that you can build pages in either language and know that they will be supported on most mobile web browsers. If backward compatibility is a huge issue, you might lean toward WML. If you want a language that more cleanly separates content from presentation, XHTML Mobile is the answer. And finally, you may find that mixing the languages across different pages provides you with the most flexibility.

When I refer to mixing WAP and XHTML Mobile, I don't mean mixing them within the same document. I mean that you can create a WAP document and link it to an XHTML Mobile document.

The remainder of the tutorial focuses on the WML and XHTML Mobile languages, and how to use them to build wireless web pages.