1. Home
  2. Computing & Technology
  3. Wireless / Networking
Introduction to WAP
WAP supports the delivery of Web content over wireless networks

WAP and WML

The single most popular component of WAP is undoubtedly Wireless Markup Language (WML). WML allows developers to specify how content will be presented to a WAP browser. WML can be compared to HTML in terms of its syntax and functionality, but many differences between the two exist.

 More of this Feature
• Part 1: Introduction to WAP
• Part 3: WAP Applications and Future
 
 Join the Discussion
"How long will it be before mobile wireless networks with WML-based content offer something really interesting to the general public? One year? Five years? Never??"
AB_COMPNETWK
 
  Related Resources
• Wireless Networking Directory
 
 Elsewhere on the Web
• WAP Forum Home Page
 
 

In general, HTML (especially in combination with JavaScript) requires more memory and processing power to support a browser than is desirable for a wireless device like a cell phone or PDA. WML strives to be a more viable alternative by stripping out the unneeded features of HTML and enforcing conventions that make pages easier to parse.

WML Syntax

WML supports a tag-based syntax just like HTML. Many tags with the same name can be found in both languages, although the behavior of these tags may differ:

	<a>
	<img>
	<input>
	<p>
	<select>

WML attempts to improve on the inconsistent syntax seen in much of today's HTML. WML generally requires stricter conformance to standards -- specifically the inclusion of end-tags or closed empty-element tags. For example, the <p> tag must always be followed by a matching </p> tag (or else the page will not display). Tags without a matching end tag, such as br, must incorporate the ending slash as follows:

	<br/>
Because WML is a subset of XML designed for XML parsers, the top of every WML page includes the following header information to specify the Document Type Description (DTD):
	<?xml version="1.0">
	<!DOCTYPE wml PUBLIC
		"-//WAPFORUM//DTD WML 1.1//EN"
		"http://www.wapforum.org/DTD/wml_1.1.xml">
WML Cards and Decks

The most apparent difference between WML and HTML source files is the concept of WML cards and the <card> tag. Cards effectively implement multiple WML screens within a single page. WAP browsers display only one card at a time, but they load a page file (called a deck) that contains multiple cards in one transaction.

Loading multiple cards at once caches potential screen views locally on the WAP browser to reduce the need for network requests. In addition, one network request to fetch a file the size of a typical HTML page will generally execute faster than a series of requests for much smaller pieces of the file. In these ways, WAP’s implementation of cards and desks is a clever optimization of the limited bandwidth on today’s wireless networks.

Is WML A Programming Language?

Most software developers agree that HTML (by itself, without JavaScript) is only a markup language and not a true programming language. HTML lacks variable assignments, control flow statements, and conditionals. WML, however, is much closer to a programming language if not squarely in that camp.

WML supports variables. The <setvar> tag assigns a value to an alphanumeric name as follows:

	<setvar name="index" value="1">

Accessing a variable in WML is similar to Perl:

	<a href="page_$(index).wml">Next page</a>
WML supports control flow through tasks. It also supports events including timer events with the <timer> tag. These features make things like form validation in the browser easier for developers to implement in WML than HTML. Validating form data in the browser saves bandwidth over the alternative of sending data to the server for validation.

Next page > WAP Applications and the Future of WAP > Page 1, 2, 3

Subscribe to the Newsletter
Name
Email

Explore Wireless / Networking
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Wireless / Networking

©2010 About.com, a part of The New York Times Company.

All rights reserved.