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.
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
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.
Character | Description | Code |
---|---|---|
<
|
Less than | < |
>
|
Greater than | > |
'
|
Apostrophe | ' |
"
|
Quote | " |
$
|
Dollar sign | $$ |
|
Non-breaking space | |
Comments