You are on page 1of 29

<?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title="Reset on reentry example"> <!

-- Reset fields when entered backwards. --> An Introduction <onevent type="onenterbackward"> to <refresh> <setvar name="login" value=""/> <setvar name="password" value=""/> </refresh> </onevent> <!-- Read login and password from user. --> <p>Login: <input name="login"/></p> <p>Password: <input name="password"/></p> <!-- Submit button sends data to server. --> <do type="accept" label="Submit"> <go href="login.cgi" method="post">

Wireless Markup Language is light weight presentation language Used for devices with small display, low memory and processing power and low bandwidth: PDAs, Cell phones WMLScript is client side scripting language very similar to JavaScript

Support for text and images: Facility for writing text and making images to user. Support for user I/P: Supports elements for I/P Client side validation by allowing author to invoke scripts to check user I/P. Task Invocation Control: These controls initiate navigation task such as traversing link to another card. State and Context Management: Each WML introduce variables. The lifetime of variable can extend beyond single deck. The state can be shared across multiple decks.

The use of table and images are restricted. All tags are case sensitive since WML is XML application. All tags must be closed properly. Cards within deck can be related to each other with links. Card element can contain text, input fields, links, images etc. When WML page is accessed from mobile phone, all the cards in page are downloaded from WAP server.

It is subset of javaScript and forms a standard means for adding procedural logic to WML decks. It is used to do client side processing. It must be complied into bytecode before sending to client. Unlike HTML and javaScript WML has links to URLs. The WAE also describes the function set for standard library. These functions must be available on platform compatible with WAP Specification.

JavaScript based Scripting Language Procedural Language Compiled implementation Event based Integrated into WAE International Support

Phone.com browser: Used in most non-Nokia phones. emulator available with UP.SDK for http://updev.phone.com. Latest is version 5.0.

Nokia Browser: Used in recent nokia phones.Emulator avilable with nokia WAP toolkit from http://www.nokia.com/wap/. Latest is version 3.0.

Entities: WML document may contain numeric or character entities describing some characters from set of characters permitted for document. Elements: They describe all structural information and information on WML deck markup .It can include opening tag , content , internal elements and closing tag. <tag>content</tag> OR <tag/> Tags: It specifies element itself and contains type of element ,its name and unique identifier. Besides which ,attributes indicating additional properties of element can be written within tag.

WML document consists of content written in formatting tags , each enclosed in pair of angular brackets <tag>:-starts language element i.e. it is opening tag. </tag>:-it ends elements. <tag/>:-this is blank element for eg. <br/> is line break. Attributes: WML supports attributes within tag that are not displayed on screen of wireless device. It is used to describe characteristics of element. They are always represented in opening tag of element. For eg. <tag attr=value/>. Names and attributes must be written in small letters. All attributes must be enclosed in single or double quotes. Comments: Commented line is not displayed on screen. it in WML are <!-comment->

Variable:To insert value of certain variable into text of card you need to use these construction: $identifier, $(identifier) and $(identifier:conversion ). Brackets are required if space dont indicate end of variable. Whenever variable with $ leading character is encountered , value is first inserted and then interpretation is performed. Dependence on letter case:All tags, attributes and content depend upon case of entered letter. Upper case letters can compilation error. User isnt allowed to insert spaces between tag attributes, equal signs or attribute values. For eg. A and a are different variables.

Reference to DTD (Document Type Declaration) <WML> tag Document Header Template Set of cards , each having start and end tags </WML>

WML

HTML

Uses WAP WML content is organized in deck of cards Strict Syntax Many tags have required attributes

Uses HTTP HTML document represents one page Forgiving Syntax Only required attributes to be included

Cards and decks How the content is downloaded?


Whole at once

Good Practice

Card D Card C Card B Card A

Deck

WAP phones can only load pages quite slowly, and actual connection to WAP site to request page typically take half the download time, WML allows to load several WAP pages in one go. Each page is stored as card and can be navigated between just like normal WAP pages ,except that as they are already loaded into phone, they appear instantly to user. You create card using <card id= title=> tag and navigate between cards using hyperlinks or buttons ,but # before name, so to navigate to card called cardtwo your hyperlink will need to ask for #cardtwo. A card element contain text, markup, links, input-fields, tasks, images and more. cards can be related to each other with links.

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN http://www.wapforum.org/DTD/wml_1.1.xml">

<wml> <card title=My First WML Page"> <p>Hello World!</p> </card> </wml>

<a>

<a href=login.wml >Login</a>

<anchor>

<anchor>Login <go href=login.wml /> </anchor>

WBMP images HTML: <img src=logo.bmp> Empty Element tags WML: <img src=logo.wbmp alt=Logo/> Always include it in <p> tag

<input>

<select>

type, value, name, format multiple, value Why use it?

<optgroup>

Variables are used to retain values between different cards

<setvar/> is used to set a variable


<setvar name=num1 value=44/>

All variables are string values Variables can be easily posted to the server

Do element Go Task: <go> Prev Task: <prev> Refresh Task: <refresh> Noop: <noop/>

onenterforward

This event occurs when card is entered in forward directions


By selecting a hyperlink By entering URL

onenterbackward ontimer

This event occurs when card is entered using <prev> task Occurs when timer expires

Paragraph And Line Break Text Format Emphasize<em> Really empphasize<strong> Bold<b> Tables Anchor Go Prev Refresh A tag Handling user input

Input Field Select and option Tasks Go task Prev task Refresh task Noop task Do element Variables Events Onenterbackward Onenterforward Ontimer Template tag Images

SampleProg Paragraph And Line Break Text Format Tables Anchor A tag Handling user input Select and option

Output Output Output Output Output Output Output Output

Prevtasks GoTasks RefreshTask Do element Variables Ontimerevent Events Template tag Images

Output Output Output Output Output Output Output Output Output

Client based scripting language, based on JavaScript Designed to run on small devices Features
Standard Library Functions Bytecode Functions

extern function factorial (n) { var result = 0; var i; for (i=2; i<n; i++) { result *= n; } return result; }

Client configuration independence Style sheets and Images


No guarantee of display Some browsers allows minimal text formatting Support for only monochrome images

O Reilley Learning WML & WMLScript Martin Forst Emulator Manuals W3Schools Tutorials

You might also like