Wap/WML : First WML Page
Contents ]
Jean-Michel Blanchard

Content

The next step is to include the text. Unlike HTML pages, the text of a WML deck must always appear between the <p> and </p> tags. If you omit them, nothing will appear on the device display. This is what your page should look like:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http:///www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="mycard1" title="Home">
<p>
Searching with WAP
Latest news with WAP
</p>
</card>
</wml>

This code produces the following result:



Figure 2: There are no line breaks

As you may have noticed, line breaks are not taken into account on the device display. As in HTML, they have to be inserted through a special tag: <br/>. Here is the code you should use in order to obtain a correct display:

<p>
Search with WAP<br/>
Stay informed with WAP
</p>

This time, the text correctly spans two lines.



Figure 3: Here is a correctly displayed text

As in HTML, the <p> tag can contain some attributes. The one most widely used is certainly that of alignment. This attribute is very useful, specially when introducing paragraphs with specific headings:

  • align="center", for aligning the corresponding lines in the centre of the screen.

  • align="left", for aligning the corresponding lines on the left-hand side of the screen. This is the default value.

  • align="right", for aligning the corresponding lines on the right-hand side of the screen.



  1   2   3   4