WML Structure

A valid WML deck is a valid XML document and therefore must contain an XML declaration and a document type declaration (in this case for WAP 1.1) as follows:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">

A WML deck begins and ends with the wml element, while all other elements lie between these start and end tags:

<wml>
...all other elements...
</wml>

The following is a simple WML deck containing a single card. Note that the line numbers are used for reference purposes only and are not part of the actual code.

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">
<wml>
<card id="First_Card" title="First Card">
<p> The first WML example </p>
</card>
</wml> image of Example1

card Element

The card is the basic unit of navigation within a deck. It is possible to move from one card to another within the same deck or to move to another deck. Unless specified otherwise, upon navigation to another deck, the first card is displayed. The following is a simple card:

<card id="card_name" title="title">
<p>
Text containing <i> information </i>.
</p>
</card>

template Element

The template element enables the specification of certain task elements whenever any card in the deck is entered. The task specified by the template element can be overriden by another task element specified within the card.

<wml>
<template>
<do type ="options" name="Prev" label="Back">
<prev/>
</do>
</template>
<card id="First_Card" title="First Card">
<do type ="accept" name="Next" label="Next">
<go href="#Second_Card"/>
</do>
<p> Card 1 contents </p>
</card>
<card id="Second_Card" title="Second Card">
<do type ="accept" name="MySite" label="Waynes World">
<go href="http://csc.ColumbusState.edu/summers"/>
</do>
<p> Card 2 contents </p>
</card>
</wml>

image of Example1

 

Return to Programming the Wireless Web