Library tutorials & articles

Wireless Markup Language (WML) Tutorial

Getting Started

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.

first.wml

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
    "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="index" title="Welcome">
<p>
    This is my first WML document.
</p>
</card>
</wml>

Formatting Text

The following elements are supported in WML to format how the text will be displayed on the device.

Basic Elements to Format Text
Element Description
<b> some text </b> The text between these tags will be rendered in bold
<big> some text </big> The text between these tags will be rendered with a large font
<br/> This tag will force a new line. As the tag doesn't have a corresponding closing tag, a forward slash is required at the end
<em> some text </em> The text between these tags will be rendered with emphasised
<i> some text </i> The text between these tags will be rendered in italic
<p> some text </p> All text between these tags are treated as a paragraph
<small> some text </small> The text between these tags will be rendered with a small font
<strong> some text </strong> The text between these tags will be rendered with a strong emphasis
<u> some text </u> The text between these tags will be rendered underlined

The following example extends the original document to include some extra formatting.

formatted.wml

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
    "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="index" title="Welcome">
<p align="center">
    This is my <br/><em>first</em><br/> WML document.
</p>
</card>
</wml>

Output From Program

The image shows the screen of a mobile phone with the output from the program.

Displaying Special Characters in WML

The following characters all have reserved meanings in WML. To show the characters on the device, you must use the code.

Special Characters
Character Description Code
< Less than &lt;
> Greater than &gt;
' Apostrophe &apos;
" Quote &quot;
$ Dollar sign $$
Non-breaking space &nbsp;

Comments

  1. 19 Jul 2005 at 12:13

    hi
            I am Jagannath working as Sr.Programmer in Med Write India Ltd. I have one doubt that how to search the latest modified file on the stipulated time and date.If you will help me then i will be happy


    Bye
    Jagannath
    my alternate email address is b_jagan03@yahoo.co.in
    Phno : 09849654314



  2. 16 Feb 2004 at 00:49

    Nice articlae but require more info on this

  3. 01 Jan 1999 at 00:00

    This thread is for discussions of Wireless Markup Language (WML) Tutorial.

Leave a comment

Sign in or Join us (it's free).

Gez Lemon I'm available for contract work. Please visit Juicify for details.

Related podcasts

  • EarthClassMail.com - Moving from LAMP to .NET 3.5

    Scott chats with Matt Davis, architect at EarthClassMail.com, about their move from a LAMP stack (Linux/Apache/mysql/PHP) to .NET 3.5. What's working, what's not, and what kinds of issues are they running into as their architect their solution.

Events coming up

  • Dec 3

    The Auckland PHP December meetup

    Auckland, New Zealand

    Topic: Magento E-Commerce platform Speaker: Robert Popovic, LERO9, Robert is the Technical Director and co-founder of LERO9. Robert attended the Electrotechnical Faculty at The University of Belgrade where he graduated with a Masters in Computer Science and Information Technology. Robert has worked exclusively in the field of web and software development throughout his career.

Want to stay in touch with what's going on? Follow us on twitter!