Wml

  • Uploaded by: Dheeraj
  • 0
  • 0
  • December 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Wml as PDF for free.

More details

  • Words: 2,454
  • Pages: 16
April 7, 2008

New Zealand

COMPSCI 734

WML (Wireless Markup Language)

WML is a DTD of XML

WML: A Deck of Cards

WML Structure

New Zealand

The browser displays one card at a time

Card Card Card Card

The University of Auckland

The University of Auckland

New Zealand

WML applications use a card and deck metaphor A user interaction is represented p by y a card,, while a complete task is represented by a deck A deck is the smallest unit of WML a web server can send to a WAP browser, and it contains one or more cards

© Manoharan

Developped from an earlier language called HDML (Handheld Devices Markup Language) from a company called Unwired Planet This is “HTML” for wireless devices that are usually resource limited

The University of Auckland

The University of Auckland

New Zealand

WML and WML Script

1

COMPSCI 734

April 7, 2008

Hello World!

Hello World!







"http://www.wapforum.org/DTD/wml13.dtd"> New Zealand

<wml>

Hello /
br/ Hello World!
Click Me here…



The University of Auckland

The University of Auckland

New Zealand

"http://www.wapforum.org/DTD/wml_1.1.xml">

WML Example #1

WML Example #1: Splash

Deck

Splash

© Manoharan

People c734

c335

New Zealand

Courses

The University of Auckland

The University of Auckland

New Zealand

Index

c334

<wml>

Hello /
br/ Hello World!
Click Me here…



Welcome
Uni Wap Server
Enter the Uni



2

COMPSCI 734

April 7, 2008

New Zealand

Choose the info type: <select>



WML Example #1: Courses

© Manoharan

New Zealand

WML Example #1: c335

Distributed Objects & Web Services Next Semester.



The University of Auckland

The University of Auckland

New Zealand

WML Example #1: c334

Internet Programming Currently on.



Internet Programming
Distributed Objects & Web Services
Pervasive Computing & the Enterprise



The University of Auckland

The University of Auckland

New Zealand

WML Example #1: Index

3

COMPSCI 734

April 7, 2008

WML Example #2: Basic Animation

Splash

WML Example #2: Splash

Deck

Splash3 Index

New Zealand

Splash2

The University of Auckland

The University of Auckland

New Zealand

Splash1

© Manoharan

Work in progress. Please visit later.



The University of Auckland

Pervasive Computing & the Enterprise Currently on.



New Zealand

WML Example #1: People

The University of Auckland

New Zealand

WML Example #1: c734

type= ontimer >


*
Uni Wap Services



4

COMPSCI 734

April 7, 2008

New Zealand

h f "#S l h2"/


\|/
-- -
/|\
Uni Wap Services



WML Example #2: Splash2

The University of Auckland

The University of Auckland

New Zealand

WML Example #2: Splash1

© Manoharan

New Zealand

li " t " Welcome
Uni Wap Server "Enter the Uni"



WML Example #3: Softkeys

The University of Auckland

The University of Auckland

New Zealand

WML Example #2: Splash3

#Splash3 />


\ | /

--

/ | \
Uni Wap Services



center > Welcome
Uni Wap Server <do type="accept" label="Enter the Uni">



5

COMPSCI 734

April 7, 2008

WML Example #4a: InputNumbers

WML Example #4

Deck

InputNumbers asks for two numbers, and Result displays the sum

New Zealand

Result

The University of Auckland

The University of Auckland

New Zealand

InputNumbers

© Manoharan

Link using anchor

New Zealand

Enter Two Numbers to Add
n1:
n2:
Get Results



Link using soft keys

WML Example #4: Result

The University of Auckland

The University of Auckland

New Zealand

WML Example #4b: InputNumbers

center > Enter Two Numbers to Add
n1:
n2:

/p <do type="accept" label="Add">


lt "

Thanks for using the Add2 Tool
You wanted to add $(n1) and $(n2)



To use $ as part of the text, one must use $$

6

COMPSCI 734

April 7, 2008

New Zealand

Enter Two Numbers to Add
n1:
n2:

<do type="accept" label="Add"> An extra button to clear input fields <do type="reset" label="Clear"> <setvar name="n1" value=""/> <setvar name="n2" value=""/>


WML Example #4d: InputNumbers

The University of Auckland

The University of Auckland

New Zealand

WML Example #4c: InputNumbers

Soft keys

EnterBackward event clears input fields

WML Script

User-interface for soft keys differ from phone to phone. Some phones do not even support soft keys.

Based on ECMA Script, a derivative of JavaScript Allows defining g functions that can be called from WML,, in much the same way as calling JavaScript functions in HTML

New Zealand

New Zealand

The University of Auckland

The University of Auckland

Avoid using soft keys. Use anchors instead.

© Manoharan

type= onenterbackward > <setvar name="n1" value=""/> <setvar name="n2" value=""/>

Enter Two Numbers to Add
n1:
n2:

<do type="accept" label="Add">


The main difference between JavaScript and WML Script is that WML Script functions are contained in a separate file and WML contains references to the URL address of the file, whereas JavaScript functions are normally embedded in the HTML code.

7

COMPSCI 734

April 7, 2008

WML Script

WML Script

Reduces network round-trips and enhance functionality. Example p usages g

Not object-oriented, or even object-based. New variables are decalred using g the var keyword y (e.g. ( g var x;) Types aren’t explicitly declared, so there is no need to do type checking

Field validation •

Check for formatting, input ranges, etc. Download some intelligence into the device Access device or vendor-specific API

The University of Auckland



New Zealand



Device extensions

The University of Auckland

New Zealand

Conditional logic

Referencing Variables

WML Script

WML Script units have to be compiled into binary WML Script code before they can be executed in a WAP device.

Variable reference

The WAP gateway normally does the compilation

New Zealand

New Zealand

The University of Auckland

The University of Auckland

WML Script Virtual Machine (VM) has to be included on the browser that executes the script.

© Manoharan

Description

$(myvar:e)

Forces escaping of symbolic characters.

$(myvar:n)

Forces no escaping of symbolic characters.

$(myvar:u)

Forces removal of symbolic character escaping.

8

COMPSCI 734

April 7, 2008



Reference outside a URL

New Zealand

yp <setvar name="urlA" value="file nameA.wml"/> <setvar name="urlB" value="file%20nameB.wml"/>

urlA $(urlA)
urlB $(urlB)
urlA:n $(urlA:n)
urlB:n h f "$( lB )" lB $(urlB:n)
$( lB ) / b/ urlA:u $(urlA:u)
urlB:u $(urlB:u)
urlA:e $(urlA:e)
urlB:e $(urlB:e)


Referencing Variables

The University of Auckland

The University of Auckland

New Zealand

Referencing Variables

Referencing Variables

$(urlA)

file nameA.wml

$(urlB)

file%20nameB.wml

$(urlA:n)

file nameA.wml

$(urlB:n)

file%20nameB.wml

$(urlA:u)

file nameA.wml

$(urlB:u)

file nameB.wml

$(urlA:e)

file%20nameA.wml

$(urlB:e)

file%2520nameB.wml

WML Example #5

Reference within a URL

© Manoharan

D k Deck

file%20nameA.wml file%2520nameB.wml

$(urlA:n)

file%20nameA.wml

$(urlB:n)

file%20nameB.wml

$(urlA:u)

file%20nameA.wml

$(urlB:u)

file%20nameB.wml

$(urlA:e)

file%20nameA.wml

$(urlB:e)

file%2520nameB.wml

InputNumbers New Zealand

$(urlB)

The University of Auckland

The University of Auckland

New Zealand

$(urlA)

Result

InputNumbers asks for two numbers, and Result displays the sum

9

COMPSCI 734

April 7, 2008

New Zealand

Enter Two Numbers to Add
n1:
n2:

<do type="accept" label="Add">


WML Example #5: Result

The University of Auckland

The University of Auckland

New Zealand

WML Example #5: InputNumbers

© Manoharan

New Zealand

extern function add2() { var n1 = Lang.parseInt(WMLBrowser.getVar("n1")); var n2 = Lang.parseInt(WMLBrowser.getVar("n2")); var sum = n1 + n2; var sumStr = String.format("%d", sum); WMLBrowser.setVar("reslt", WMLBrowser.setVar( reslt , sumStr); WMLBrowser.go( "add2.wml#Result" ); }

WMLS Example #6

The University of Auckland

The University of Auckland

New Zealand

WMLS Example #5

Thanks for using the Add2 Tool
You wanted to add $(n1) and $(n2)
The result you require is $(reslt)



extern function add2() { var n1 = Lang.parseInt(WMLBrowser.getVar("n1")); var n2 = Lang.parseInt(WMLBrowser.getVar("n2")); var sum = n1 + n2; var sumStr = String.format("%d", sum); Dialogs alert("The res Dialogs.alert("The result lt is is: " + ssumStr); mStr) }

10

COMPSCI 734

April 7, 2008

WML Script

WML Script Libraries

Lang

Literals can be of the following types: boolean, integer, string, floating point, and invalids

Lang library includes functions for data type manipulations, absolute value l calculations, l l ti general-purpose l math th ffunctionality, ti lit and d random d number generation

WML Script Libraries

Dialogs.alert(“The parameter is: “ + parameter);

Dialogs.confirm(text, ok, cancel)

© Manoharan

New Zealand

Dialogs.confirm(“The parameter is: “ + parameter, “OK”, “NOTOK”);

Dialogs.prompt(text, default) Dialogs.prompt(“Who are you?”, “James Bond”);

The University of Auckland

The University of Auckland

New Zealand

Browser

Provides a set of typical user-interface functions such as prompt(), confirm(), and alert()

The String library contains methods such as length(), charAt(), find(), etc. etc

Dialogs.alert(text)

The URL library contains functions such as getPath(), getReferer(), getHost(), etc.

Dialog

String

The Dialogs Library

URL

WML browser interface Provides interaction with the browser

Optional Float library includes functions such as pow(), round(), etc, but only supported on devices with floating point capabilities

The University of Auckland

New Zealand The University of Auckland

d = myFloat / 0; if ( d == invalid ) { // divide by zero error }

New Zealand

Float

var mString = “hello world”; var myInteger = 34; var myFloat = 3.142; var d;

11

COMPSCI 734

April 7, 2008

New Zealand

Standard Library Functions

Basic String Manipulation

Basic String Manipulation

String.substring(string, position, length); String.find(string, substring);

White Space New Zealand

String.isEmpty(string) String.length(string) String.charAt(string, position)

Substrings

String.squeeze() String.trim()

The University of Auckland

The University of Auckland

New Zealand

The String library offers all manner of functionality for handling and processing strings. Example

© Manoharan

Lang.random(parameter) Lang.maxInt() g () Lang.minInt() Float.maxFloat() Float.minFloat() Float.pow(number, power); Float.sqrt()

The University of Auckland

Lang.max(myVal1, myVal2); Lang.min(myVal1, g ( y , myVal2); y ); Lang.abs(myVal) Float.int(myVal) Float.floor(myVal) Float.ceil(myVal) Float.round(myVal)

The University of Auckland

New Zealand

Standard Library Functions

12

COMPSCI 734

April 7, 2008

String Formatting

Strings as Arrays

String.format(template, value);

Standard Library String-Access Fuctions

The formatting template is similar to the format specification used in C’s printf.

New Zealand The University of Auckland

The University of Auckland

New Zealand

• d for integer • f for float • s for string

WTAI

WTAI

Wireless Telephony Application Interface is a means to create telephony applications using a WTA user-agent with appropriate libraries

WTAI includes:

Not all phones support WTAI. Check if your phone does!

New Zealand

Calling a number through URL reference wtai://wp/mc;777

Call control Network text messaging Phone book interface Indicator control Event processing

WTAI available in WML and WML Script

The University of Auckland

The University of Auckland

New Zealand

Calling a number using WML Script WTAPublic.makeCall("777");

© Manoharan

string.elements() string.elementAt() string.removeAt() string.replaceAt() string.insertAt()

13

COMPSCI 734

April 7, 2008

Sample Application #1

Sample Application #1 (2)

New Zealand

Dialler >

Enter the number to call:

/p <do type="accept" label="Dial number">


Sample Application #2

WTAI

Other useful WTAI functions include WTAPublic.addPBEntry, WTAPublic.sendDTMF, WTAPhoneBook.write, and WTAPhoneBook.search. Refer to the specification for details.

© Manoharan

New Zealand The University of Auckland

The University of Auckland

New Zealand

<wml> Dialler >

Enter a number to call:

/p <do type="accept" label="Dial number">


extern t function f ti dial() di l() { var n1 = Lang.parseInt(WMLBrowser.getVar("n")); WTAPublic.makeCall(n1); }

The University of Auckland

The University of Auckland

New Zealand

<wml>

14

COMPSCI 734

April 7, 2008

Limits

Limits

There is a limit on the maximum compiled deck size, and this varies from device to device

The history buffer is also limited. Explicit “back” links may be required rather than relying on the history buffer to go back. E.g., Alcatel 525 has a history buffer of size 10. New Zealand

The maximum size of a WBMP image too is limited.

Write a WML application for English dictionary lookup. Use a web service for the actual dictionary lookup.

Write an MCQ Testing suite using WML. Use questions from COMPSCI 334-35 as sample data. New Zealand

Wireless Markup Language Specification. www.WAPForum.org. WML Script Specification. WML Script Standard Libraries Specification. WAP Wireless Telephony Application Interface.

Exercises

The University of Auckland

The University of Auckland

New Zealand

Further Reading

© Manoharan

E.g., Alcatel 525 has a limit of 784 bytes.

The University of Auckland

The University of Auckland

New Zealand

Nokia 7110’s is 1397 bytes while Alcatel 525’s is 6656 bytes

The contents will not be loaded, if the maximum size is exceeded. Maximum number of cards within a deck and the maximum size of a card are bounded by the maximum size of the deck.

15

COMPSCI 734

April 7, 2008

Exercises

The University of Auckland

New Zealand

Find out an approximate maximum deck size supported a mobile phone of your choice. Describe the card-and-deck metaphor used by WML applications, and discuss why such a metaphor is chosen.

© Manoharan

16

Related Documents

Wml
May 2020 18
Wml
December 2019 31
Wap-wml
December 2019 20
Dasar Wml
June 2020 5

More Documents from ""

Computer Underground
December 2019 31
Mo 4 Iso Mgmt 2
December 2019 19
Des Haw 4
April 2020 14
Wimaxworld_2008
December 2019 24
5 Motivation
December 2019 25