WAP WML Script - WAP

Explain briefly about the WML script used for WAP

The Wireless Markup Language Script (WML Script) is the scripting language of WML. Scripting language is lighter than the programming language. WML script is used for processing and computation and facilitates in reducing the number of requests and the responses to/from the server.

What are the important components of WML Script?

All the WML Script components mean the same as that of the Java Script and hence WML Script is similar to that of Java Script. The components of the WML Script program are:

WML Script Operators

The following mentioned are the operators supported by WML Script:

  • Arithmetic Operators
  • Comparison Operators
  • Logical (or Relational) Operators
  • Assignment Operators
  • Conditional (or ternary) Operators

The detailed information about the WML operators is available at The WML Operators .

WML Script Control Statements

The sequence and the iteration in a program are controlled by the Control statements such as:

Conditional branching
Making self-incremented fixed iteration loop
Making variable iteration loop
Terminates a loop
Quit the current iteration of a loop

The detailed information about the WML Script Control statements is available at the link WML Script Control Statements .

WML Script Functions

A separate file with the extension .wmls, declares the user-defined functions as follows:

The functions used are stored in a separate file with the extension .wmls. The functions are called as the filename followed by a hash, followed by the function name:

WML Scripts Standard Libraries

There are six standard libraries totally. An overview of them is as follows:

  • Lang: The functions related to the WMLScript language core are provided by this language library.
  • Example Function: abs(),abort(), characterSet(),float(), isFloat(), isInt(), max(), isMax(), min(), minInt(), maxInt(), parseFloat(), parseInt(), random(), seed()
  • Float: The functions that help to perform floating-point arithmetic operations are provided by the float library.
  • Example Function: sqrt(), round(), pow(), ceil(), floor(), int(), maxFloat(), minFloat()
  • String: A number of functions which enable to manipulate the strings are provided by the String library.
  • Example Function: length(), charAt(), find(), replace(), trim(), compare(), format(), isEmpty(), squeeze(), toString(), elementAt(), elements(), insertAt(), removeAt(), replaceAt()
  • URL: The functions which enable to manipulate the URLs are provided by the URL library.
  • Example Function: getPath(), getReferer(), getHost(), getBase(), escapeString(), isValid(), loadString(), resolve(), unescapeString(), getFragment()
  • WMLBrowser: The WMLBrowser library provides a group of functions to control the WML browser or to get information from it.
  • Example Function: go(), prev(), next(), getCurrentCard(), refresh(), getVar(), setVar()
  • Dialogs: The user interface functions are provided by the Dialog library.
  • Example Function: prompt(), confirm(), alert()

WML Scripts Comments

There are two types of comments in WMLScript:

  • Single-line comment: To add a single-line comment, begin a line of text with the // characters.
  • Multi-line comment: To add a multi-line comment, enclose the text within /* and */.

The above mentioned rules remain same for WML Script, Java and C++. The comments are ignored by the WML Script and an illustration demonstrating the use of comments is as follows:

WML Script Case Sensitivity

The WMLScript language is case-sensitive. For instnce, a WMLScript function with the name WMLScript Function is different from wmlscript function. Hence a function or a variable need to be defined or referred in WML Script very carefully.

Whitespaces in WMLScript

The extra whitespaces like spaces, tabs and newlines are being ignored by the WML Script.

WML Script Statement Termination by Semicolons

A statement is ended with a semicolon in WML Script, similar to that of C++ and Java. It is mandatory in WML Script.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

WAP Topics