The Internet Encyclopedia (Volume 3)

(coco) #1

P1: IML


Cassel WL040/Bidgoli-Vol III-Ch-65 September 15, 2003 8:52 Char Count= 0


808 WIRELESSAPPLICATIONPROTOCOL(WAP)

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML
1.3//EN" "http://www.phone.com/dtd/wml13.dtd">
<!-- WML file created by Openwave SDK -->
<wml>
<card id ="Start">
<p align="center"> <b> City
information</b> </p>
</card>
</wml>
Figure 4: First WML card specification.

of cards, much as people sometimes use in gathering
research data in a library. Each card contains a small
amount of content and may contain links to other cards
in the same deck, to cards in other decks, or even to con-
ventional Web pages.
An example application is the best way to illus-
trate and introduce WML. The example is developed us-
ing the Openwave SDK, available free from http://www.
openwave.com. The simulated displays for a mobile
phone are part of the SDK. The appearance of output from
a WML specification will vary by the nature of the device
on which it is displayed.
The example allows a client to obtain information
about a particular city. The first screen identifies the ap-
plication. The WML code for this initial card is shown in
Figure 4.
The first two lines of this WML file reflect the XML
connection. This identifies the XML version and allows

Figure 5: Simulated display of
first WML code.

valid compilation of the file. The actual WML specifica-
tion begins with<wml>and ends with</wml>. Like other
XML applications, each WML element has both an open
and a close component. Notice that the<p>(paragraph)
tag must be closed by</p>, unlike ordinary HTML. The
<wml>...</wml>tags mark the beginning and end of
this deck. The deck may contain as many cards as the
application requires. Each card is specified by<card>
...</card>. The<card>tag shows an ID for this card
that can be used to reference it from other cards. The
title of this card has been centered by an option in the
<p> tag and made bold by the usual<b> ...</b>.
Figure 5 shows the simulated output for this first WML
example.
Next, the example adds options to the display. Each op-
tion will consist of a link to another card with further in-
formation on the chosen topic. This requires a list. The list
in this application will allow the user to choose weather
information, restaurants, museums, or information about
public transportation. Each option in the list specifies the
next card to visit if that option is selected. The entire se-
lect list goes inside a<p>...</p>tag element. The code
follows:

<select name = "listname">
<option event = "link"> Label </option>
</select>

The syntax for the list in which each option links to
another card in the current deck is

<?xml version = "1.0"?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD
WML 1.3//EN"
"http://www.phone.com/dtd/wml13.dtd">
<!-- WML file created by Openwave SDK -->
<wml>
<card id = "Start">
<p align = "center"> <b> City information
</b>
</p>
<p align = "center">
<select name = "categories">
<option onpick = "#weather">
Weather Forecast </option>
<option onpick = "#restaurants">
Restaurant List </option>
<option onpick = "#museums"> Museums
</option>
<option onpick = "#trans">
Public Transportation </option>
</select>
</card>
</wml>

Thelistnamejoins this set of options with a com-
mon title.Labelis displayed on the user screen.eventis
the occurrence that causes this item to be selected from
among the options available.linkidentifies the card to
be displayed next. The following code includes a list of
options for city information. Each link is relative; in fact
it is a reference to a card in the same deck. The syntax for
Free download pdf