
by David Sims
07/28/2000
|
Related Articles: Mobile Phone Developer Programs |
WML, the Wireless Markup Language, is the language adopted by members of the WAP Forum to deliver web content to wireless devices (by which we mean, mostly, cell phones). The language is a descendent of the Handheld Device Markup Language, itself a subset of HTML, based on the World Wide Web Consortium's Guidelines for Mobile Access.
Like HTML, WML specifies the format of your content and thus how it will display. It also specifies how documents are linked and how data is gathered in forms. In future tutorials, we'll look at WMLScript and language based on ECMAscript, which is similar to JavaScript. It lets you begin doing things like checking input on forms.
Because of the very limited screen size available to display information on a mobile phone, WML uses the metaphor of a deck of cards to send data. For web developers, this requires a slight shift of thinking, from the model of a document that may be broken into several sections or web pages, to that of a deck that is broken into several cards. The idea here is to get developers thinking in terms not only of how the display is different on small portable devices, but how the function should differ, too.
In this introduction, we'll show you how to get started with WML by downloading one of the emulators, writing a Hello World first program, and learning how to link and assign functions to buttons on the phone.
Install an emulator
To begin writing and testing WML code, you should have a mobile phone emulator. You can download these from any of several places. In effect, they're a small app that displays as a cell phone running in a window on your screen. The keys are enabled so you can get some sense of how easy (or cumbersome) navigation is on these phones. And the screen real estate differs on different emulators, just as it does on different phones. Something that looks great on a large, new Samsung screen may be a lot tougher on a Motorola Star-Tac phone's smaller screen. (But everything has its advantages: the Star-Tac reportedly has a lower SAR -- the Standard Absorption Rate that measures how much electromagnetic energy is pumping from the antenna into your brain. So pick your poison.)
Two easy-to-get emulators are from Phone.com and Nokia. Phone.com's minibrowser is the most popular browser in PCS phones sold in the United States. You can get its emulator as part of the UP.SDK by joining Phone.com's developer program. For Nokia's emulator, visit Forum Nokia. AnyWhereYouGo.com has a more complete list of emulators.
Once you've downloaded and installed the emulator, pull up a text editor and begin writing or copying the code below.
Hello wireless world
Here's a basic first program in WML:
1<?xml version="1.0"?>2<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">3<wml>4<card>5<p>6Hello Wireless World7</p>8</card>9</wml>
Line 1 declares that this is an XML-compliant document.
Line 2 tells where the document type definition (DTD) is. In this case, the DTD is the spec for WML 1.2, which is found on the WAP Forum's web site.
Line 3 opens the description of the document, similar to the <html> tag on web pages. For all intents and purposes, this tag also opens the deck that will have one or more cards in it.
Line 4 opens the first (and only) card in the deck.
Lines 5 through 7 reflect the same paragraph structure found in HTML, and lines 8 and 9 close out the code. Note that since this is an XML-compliant document, all tags are lower case, and they all must close. Sloppy HTML lets us, for example, leave <p> tags open, but XML forces us to tidy up our coding habits.
Pretty simple stuff.
Pages: 1, 2 |



