Wireless Markup Language

When its time to find out how to make content available over WAP, we need to get to grips with its Markup Language. ie, WML. WML was designed from the start as a markup language to describe display of content on small screen devices.

It is a Markup language enabling the formatting of text in WAP environment using a variety of markup tags to determine the display appearance of content. WML is defined using the rules of XML-extensible markup language and therefore an XML application. WML provides a means of allowing the user to navigate around the WAP application and supports the use of anchored links as found commonly in the web pages. It also provides support for images and layout within the constraints of the device.

WML (Wireless Markup Language) is the first markup language standard for wireless devices. It is supported by all the major mobile phone manufacturers. At the beginning of this WML tutorial, you can learn about the basics of WML, such as the deck and card concept, WML's document structure and syntax, etc. Then topics like font styles, images, tables, anchor links and softkeys will be covered. After that we will move on to more advanced topics of WML like events, input elements, variables, and the submission of form data to the server. Plenty of code examples are given in the WML tutorial to help you understand the concepts and techniques.

WML (Wireless Markup Language) 1.x is the markup language defined in the WAP 1.x specification. WAP is the standard created by the WAP Forum (now the Open Mobile Alliance [OMA]) that brings the World Wide Web to wireless devices. It specifies the protocol stack and application environment of mobile Internet browsing applications.

The role of WML in mobile Internet applications is the same as that of HTML in web applications. WAP sites are written in WML, while web sites are written in HTML.

WML 1.x is very similar to HTML. Both of them use tags and are written in plain text format. Some tags in WML 1.x are directly borrowed from HTML. If you have experience in using the HTML markup language, you should be able to learn WML 1.x quickly.

Some features of WML 1.x are specific to wireless devices. For example, WML 1.x provides a way for developers to program the softkeys of mobile phones. This feature is not supported in HTML since computers do not have any softkeys.

The most up-to-date version of the WAP 1.x specification is WAP 1.2.1, which defines WML 1.3.

WML files have the extension ".wml". The MIME type of WML is "text/vnd.wap.wml".

WML supports client-side scripting. The scripting language supported is called WMLScript. Its syntax is based on JavaScript. If you want to learn it, our WMLScript tutorial will be a good starting point for you.

The Wireless Markup Language (WML) is the markup language used to make sites suitable for viewing using a WAP (Wireless Application Protocol) device. If you don't have a WAP device to view the pages, you can get a simulator by downloading the Wireless Companion from YourWAP. The Wireless Markup Language (WML) documents are based on the Extensible Markup Language (XML), and as such need to be well-formed.

  • WML is case sensitive. Elements and attributes are all in lowercase.
  • All tags must have closing tags.
  • Tags must be nested correctly.
  • All attribute values must be enclosed in either single or double quotes.

A WML document must correspond to a valid Document Type Definition (DTD). The DTD used throughout this tutorial is wml_1.1.xml. The DTD should be specified at the top of the document following an xml declaration, as in the following example.

WML Cards

The content of the page is placed between wml tags within the document. WAP sites consist of cards rather than pages. Each card represents the text that will be displayed on the device's screen. Not surprisingly, a collection of cards is referred to as a deck. A single document may contain one or more cards. Each card should contain an id attribute, and a title attribute. The id attribute is used for linking, and the title attribute will be displayed as the title on the device's screen. The following example defines a basic WML document with a single card.

Wireless Markup Language is a lot like HTML (Hyper Text Markup Language) in that it provides navigational support, data input, hyperlinks, text and image presentation, and forms. A WML document is known as a “deck”. Data in the deck is structured into one or more “cards” (pages) – each of which represents a single interaction with the user. The introduction of the terms "deck" and "card" into the internet and mobile phone communities was a result of the user interface software and its interaction with wireless communications services having to comply with the requirements of the laws of two or more nations.

WML decks are stored on an ordinary web server trivially configured to serve the text/vnd.wap.wml MIME type in addition to plain HTML and variants. The WML cards when requested by a device are accessed by a bridge WAP gateway, which sits between mobile devices and the World Wide Web, passing pages from one to the other much like a proxy. The gateways radio the WML pages in a form suitable for mobile device reception. This process is hidden from the phone, so it may access the page in the same way as a browser accesses HTML, using a URL (for example, http://example.com/foo.wml), provided the mobile phone operator has not specifically locked the phone to prevent access of user-specified URLs.

WML has a scaled down set of procedural elements which can be used by the author to control navigation to other cards.

It is an error and misconception to think of WML as a pinhole view of the Internet. The real magic and value of WML is that it provides an interface with the phone hardware to initiate a call based on web content requested by user query, for example the telephone number of a taxi servicing your zip code:

Mobile devices are moving towards support for greater amounts of XHTML and even standard HTML as processing power in handsets increases. These standards are concerned with formatting and presentation. They do not however address cell-phone or mobile device hardware interfacing.

WML can be a very powerful and effective cell-phone add on. It lets you for example enter a zip code, and obtain a list of clickable phone numbers of pizza parlors and taxicabs in your immediate location.