Skip to content
Related Articles

Related Articles

WML | Introduction

View Discussion
Improve Article
Save Article
  • Last Updated : 02 Mar, 2020

WML stands for Wireless Markup Language (WML) which is based on HTML and HDML. It is specified as an XML document type. It is a markup language used to develop websites for mobile phones. While designing with WML, constraints of wireless devices such as small display screens, limited memory, low bandwidth of transmission and small resources have to be considered. WAP (Wireless Application Protocol) sites are different from normal HTML sites in the fact that they are monochromatic (only black and white), concise and has very small screen space, due to which content in the WAP sites will be only the significant matter, much like how telegraph used to work in the olden days. The concept WML follows is that of a deck and card metaphor. A WML document is thought of as made up of many cards. Just like how cards can be grouped to form a deck, a WAP site has many cards. One card will be displayed at a time on the screen, just like how one page is displayed at a time in an HTML website. Many cards can be inserted into a WML document, and the WML deck is identified by a URL. To access the deck, the user can navigate using the WML browser, which fetches the deck as required.

Features of WML:

  • Text and Images: WML gives a clue about how the text and images can be presented to the user. The final presentation depends upon the user. Pictures need to be in WBMP format and will be monochrome.
  • User Interaction: WML supports different elements for input like password entry, option selector and text entry control. The user is free to choose inputs such as keys or voice.
  • Navigation: WML offers hyperlink navigation and browsing history.
  • Context Management: The state can be shared across different decks and can also be saved between different decks.

Problems Faced by a Web Application When Used With a Mobile and Wireless Environment:

1. HTTP:

  • Bandwidth and delay: HTTP is not made for low bandwidth and high delay connections in mind. HTTP protocol headers are large and redundant as HTTP is uncompressed and stateless.
  • Caching: Caching is disabled by content providers as client companies cannot get feedback if a cache is placed between a server and a client. Users suffer from downloading the same content repeatedly from the server as HTTP is stateless.
  • Posting: Sending some content from a client to a server will create additional problems if the said client is disconnected at that moment.

2. HTML: HTML was designed for use in creating content for webpages of the World Wide Web (www). It was meant only for desktop initially. Thus, when used in hand-held devices, some problems arise:

  • Small display and low-resolution.
  • Limited User Interfaces.
  • Low-Performance CPU.

Enhancements needed for use of HTML in wireless environments:

  • Image scaling
  • Content Transformation: Documents in PDF or PPS should be transformed into the plain text as PDF occupies more memory.
  • Content Extraction: To avoid longer duration waits, some content like headlines can be extracted from the document and presented to the user. This lets the user decide which information alone needs to be downloaded.

Enhancements needed for use of HTTP in wireless environments:

  • Connection Re-use: Client and server can be used the same TCP (Transmission Control Protocol) connection for several requests and responses. Pipelining can be used to improve performance.
  • Caching Enhancements: A cache could store cacheable response to reduce response time and bandwidth for further responses. Caching can be done in the mobile client’s web browser itself by using a client proxy. A network proxy can also be used on the network side.
  • Bandwidth Optimization: HTTP supports compression and also negotiates the compression parameters and compression styles. This will allow partial transmissions.

WMLScript: WMLScript is the client-side scripting language of WML in Wireless Application Protocol(WAP) and whose content is static. It is similar to JavaScript. It is optimized for low power devices and is a compiled language. Some of the standard libraries of WMLScript are Lang, Float, String, URL, WML Browser, Dialog, and WMLScript Crypto Library.

Declaring A WML Document and Cards: To create a WML document, type it in notepad, just like for HTML. The first line should be something like this:

<?xml version="1.0"?>
"-//WAPFORUM//DTD WML 1.1//EN" "">
        <card id="index" 
              title="My WAP Site Using WML" 

Which tells the phone that it is going to interpret a WML document and the WML standards. A card with the ID contents (used for linking) will be generated and the output at the top of the screen will be. It is extremely important to close all WML tags, unlike HTML tags. If you do not close a WML tag, a card will not open at all. You have to close both the <card> and <wml> tags.

Example: The code below shows a sample WML coding for a small WAP site with two cards and a link to an external website.

<?xml version="1.0"?>
"-//WAPFORUM//DTD WML 1.1//EN" "">
        <!-- This is first card-->
        <card id="one" title="First Card">
            <h1> Geeksforgeeks </h1>
                A Computer Science Portal for Geeks
        <!-- This is second card-->
        <card id="two" title="Second Card">
                This is created by WML


Comparison of WML with HTML:

  • WML is used only for WAP sites on mobile phones and can be hosted only be WAP hosts that support WML. HTML can be hosted by any web server.
  • WML sites are monochrome, unlike HTML sites.
  • Coding is similar in many aspects but a badly coded WAP site will definitely not run as compared to a badly coded HTML site.
  • It is must to close all WML tags as compared to the more lenient HTML coding.
  • There are no alignment tags like the <center> tag in WML, as in HTML. Instead, <p align=”center”> has to be used for aligning text in WML.
  • There are problems when using old HTML tags like <br> which have no closing tag. To get around this in WML, some tags have a “/” put on the end like <br />.
  • Only WBMP format monochrome images are supported in WML whereas there is no such restriction in HTML.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!