Sie sind auf Seite 1von 9

Wireless Mark up Language

Definition: A tag-based language used in the Wireless Application Protocol (WAP). WML is
an XML document type allowing standard XML and HTML tools to be used to develop WML
applications. In other words it is used create web pages on WAP enabled mobile phones.

Overview: This tutorial serves an introduction to WML, explaining it’s concept, benefits,
example etc .

Topics:

Introduction
History of WML.
Benefits
Why should I use WML?
Understanding WML
Sample WML program
Summary
Self Test
Correct Answers
Glossary

INTRODUCTION
WML is a markup language that is based on XML (extensible Markup Language). The official
WML specification is developed and maintained by the WAP Forum, an industry-wide
consortium founded by Nokia, Phone.com, Motorola, and Ericsson.
WML (Wireless Markup Language) is the new web language for making sites on mobile phones.
Over the past few months new WAP (Wireless Applications Protocol) phones have become
extremely popular and many large websites have created special 'mobile' versions of their site.
Many people predict that, over the next few years, WAP sites will become even more popular and
e-commerce over mobile phones will be widely available. The only requirement to run the WML
document is that you need a WAP browser.

HISTORY OF WML

Wireless Markup Language (WML) has been popular since it was born in 1999. It retained
almost all the features of HDML (the first wireless mark-up language), along with some
additional features such as timers. Presently, most of the wireless sites are built with WML.
Even the WAP 2.0 specifications mandate backward compatibility by demanding that WAP
2.0 phones support WML 1.X in addition to XHTML MP.

. WML was developed for WAP with limited connection bandwidth and smal screen of
mobile devices. It's different than HTML since its programming is more complicated than
HTML. For this reason, some carriers and phone manufacturers inside the WAP forum (now
integrated with OPen Mobile Alliance) felt that the wireless mark-up should evolve in the
direction of HTML to make developers' lives easier (and development more economical).
Simplifying somewhat the situation, it could be said that:

• WML had the advantage of facilitating the creation of more usable


applications, at the cost of increased complexity and cost for developers.
• HTML would lead to less usable applications, but would restate the continuity
between Web and Wireless

After many years of discussion about convergence with the W3C specifications for the
wired web, the Open Mobile Alliance introduced XHTML MP and the discontinuation of
WML 1.X. The convergence to the big web had been realized. with a cost of the loss of
some usability-related functionalities, which are expected to become less important as
devices become more capable. This is why it is likely that WML will be phased out in the
future.

BENEFITS

The best thing about WML is that it is very easy to use. However, compared to HTML, WML has
the following advantages in the context of wireless:

• WML is part of the WAP standard and its use is required.


• Transmission of WML (WMLC) documents requires less bandwidth compared to HTML
documents because WML documents are simpler and WML is compressed before it is
sent to the WAP device.
• Compared to HTML documents, displaying WML documents requires less processing
power and memory. Consequently, a WAP device can work with a less powerful
(cheaper) CPU and the use of less power means that the battery can operate longer
without recharging.
• WML provides support for limited graphics with a limited gray scale

WHY SHOULD I USE WML?


Although you might not have any plans immediately for creating a WAP version of your site, it is
always a good idea to get involved in new technology. All you need to do is make a small site
(even one page) which tells people a bit about your website. In the future you can develop the
site further with things like e-mail and information for people to get directly off their phones.

The main sites which will benefit from WAP are ones providing a service like e-mail, live sports
scores or a calendar service etc. but there are many other uses. For example, a site giving music
reviews could put their reviews on a WAP site. People could then read the reviews on their
mobile phone while browsing through the CDs in a shop.

UNDERSTANDING WML
A major difference between HTML and WML is that the basic unit of navigation in HTML is a
page, while that in WML is a card. A WML file can contain multiple cards and they form a deck.
When a user goes to a WAP site, the mobile browser loads a WML file that contains a deck of
cards from the server. Only one card will be shown on the screen of the wireless device each
time. If the user goes to another card of the same deck, the mobile browser does not have to send
any requests to the server since the file that contains the deck is already stored in the wireless
device.

WML is designed in this way because wireless devices have a high latency for connecting to the
server. Downloading a deck of cards at a time can lower the number of round trips to the server.

You can put links, text, images, input fields, option boxes and many other elements in a
card.

WML Document Structure

Hello World WML Example

Let's take a look at our first WML example. It shows the structure of a typical WML document.

(helloWorldEg1.wml)

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml13.dtd">

<wml>
<card id="card1" title="WML Tutorial">
<p>Hello World</p>
</card>

<card id="card2" title="WML Tutorial">


<p>Welcome to the world of WML</p>
</card>
</wml>

The result of the "Hello World" WML example in mobile phone emulators is
shown below:

Sony Sony Nokia


Ericsson Mobile
T68i

Ericsson T610

Browser 4.0

WML pages are called decks. They are constructed as a set of cards, related to each other with
links. When a WML page is accessed from a mobile phone, all the cards in the page are
downloaded from the WAP server to mobile phone showing the content.

WML commands and syntaxes are used to show content and to navigate between the cards.
Developers can use these commands to declare variables, format text, and show images on the
mobile phone.

WAP Program Structure:

A WML program is typically divided into two parts: the document prolog and the body.
Consider the following code:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">
<wml>
<card>
...
</card>
...more cards...
</wml>

The first line of this text says that this is an XML document and the version is 1.0. The second
line selects the document type and gives the URL of the document type definition (DTD). This
DTD gives the full XML definition of WML. The DTD referenced is defined in WAP 1.1, but
this header changes with the versions of the WML. The header must be copied exactly so that the
tool kits automatically generate this prolog.

The body is enclosed within a <wml>...</wml> tag pair as shown above. The body of a WML
document can consist of one or more of the following:

• Deck
• Card
• Content to be shown
• Navigation instructions

WML Commands:

The commands used in WML are summarized as follows:

Formatting:

Command Description

<p> Paragraph

<b> Bold

<big> Large

<em> Emphasized

<I> Italicized

<small> Small

<strong> Strongly Emphasized

<u> Underlined

<br> Line Break

Inserting images:

<img src="image-path/image - name" alt="Picture not available" />

Using Tables:

Command Description
<table> Definition of a table

<tr> Defining a row

<td> Defining a column

<Thead> Table header

Variables:

Declared as:

<setvar name="x" value="xyz"/>

Used as:

$ identifier or
$ (identifier) or
$ (Identifier; conversion)

Forms:

Command Description

<select> Define single or multiple list

<input> Input from user

<option> Defines an option in a selectable list

<fieldset> Defines a set of input fields

<optgroup> Defines an option group in a selectable list

Task Elements
Command Description
<go> Represents the action of switching to a new card
<noop> Says that nothing should be done
<prev> Represents the action of going back to the previous card
<refresh> Refreshes some specified card variables.

Events:

The various events are as follows:

Command Description

<do> Defines a do event handler

<onevent> Defines an onevent event handler


<postfield> Defines a postfield event handler

<ontimer> Defines an ontimer event handler

<onenterforward> Defines an onenterforward handler

<onenterbackward> Defines an onenterbackward handler

<onpick> Defines an onpick event handler

Sample WML Program:

Keep the following WML code into info.wml on your server. If your server is WAP enabled then
you can access this page using any WAP device.

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">
<!-- WML prolog.declaration of file type and version>

<wml>
<!-- Declaration of the WML deck>
<card id="info" newcontext="true">
<!-- declaration of a card in deck>
<p align="center"><b>Information Center</b></p>
<!--paragraph declaration to display heading>
<p>
<!--paragraph declaration to display links>
<a href="Movie.wml">1. Movies info.</a>
<a href="Weather.wml">2. Weather Info.</a>
<!--declaration of links for weather and movies>
</p>
</card>
<!-- card end>
</wml>
<!-- program end>

SUMMARY
Wap's designed is flexible for client's minimal resources such as computing power and memory
storage.WAP is programmed in wireless markup language WML (application of XML) and
WMLScript (WAP's version JavaScript) which is embedded in client's mobile. WML provides a
simple event mechanism that allows different content to be displayed. User actions, such as
pressing a key, can be tied to scripts that cause changes in content. The WML browser also has
this timer function that can load a different page or trigger the change of variables when the time
is up. This provides great flexibility than the static content that HTML can deliver.

SELF TEST
1. WML specification is developed and maintained by the …………………..
2. …………………… is the new web language for making sites on mobile phones
3. WML pages are called ……………………….
4. The basic unit of navigation in HTML is a …………………, while that in WML is a
………………..
5. WML is the first mark up language used to create WebPages on mobile phones.
a. True
b. False

CORRECT ANSWERS

1. WML specification is developed and maintained by the………………..

Answer: WAP forum

2.…………………. is the new web language for making sites on mobile phones

Answer: WML

3 WML pages are called ……………………….

Answer: cards

4. The basic unit of navigation in HTML is a …………………, while that in WML is a


………………..

Answer: 1)Page 2)cards

5. WML is the first mark up language used to create WebPages on mobile phones.

a)True

b) False

Answer: true

GLOSSARY:

XML
Extensible Mark up language

WAP
Wireless Application protocol

WML
Wireless Mark up Language

DTD
Document Type Definition

XHTML
Extensible Hyper Text Mark up Language.

Das könnte Ihnen auch gefallen