2.2 WML program structure
In the previous section we degrade a simple WML program. Readers with HTML programming can see that WML programs have many similarities in structure and form with HTML programs. Let’s analyze the structure and composition of WML programs based on an example.
2.2.1 WML elements and tags
Before analyzing the instance, it is necessary to briefly explain the elements and tags of WML. Similar to HTML, the main syntax of WML is also elements and tags. Elements are documents that conform to DTD (similar definitions for documents), such as title (document title), IMG (image), table (table), etc. The element names are case-insensitive. WML uses tags to specify the attributes of an element and its position in the document. The tag is enclosed with a less than sign (<) and a greater than sign (>), that is, it adopts the form of "<label name>". There are two types of tags that appear individually and pairwise tags. Most tags appear in pairs, consisting of the first tag and the tail tag. The first label and the tail label are also called the start label and the end label respectively. The format of the first label is "<element name>", and the format of the tail label is "</element name>". Paired labels are used to specify the range contained in the element, and the labels are used to define the range of bold characters, that is, the part wrapped between <b> and</b> is displayed in bold characters. The format of the individual tag is "<element name/>", and its function is to insert elements at the corresponding position. For example, the <br/> tag indicates that a newline is inserted at the location of the tag.
2.2.2 Example analysis of the structure and composition of WML program
After understanding the above knowledge, we are analyzing an example program below. The procedure is as follows:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "/DTD/wml_1.">
<wml>
<card ontimer="#card2" title="Tookit Demo">
<timer value="50"/>
<p aligh="center">
</br></br></br>
<big>
<!--Write your card implementation here.-->
Welcome to....
</big>
</p>
</card>
<card id-"card2" ontimer="#card 3"title="Toolkit Demo">
<timer value="50"/>
<p align="center">
<br/><br/>
<b>
The Nokia<br/>
</b>
Wireless Application Protocol
</u>
...
</p>
</card>
<card title="Toolkit Demo">
<p align="center">
<br/><br/><br/>
<big>
<i>
Toolkit
</i>
</big>
</p>
</card>
</xml>
After the program is run, three screens of information will be displayed on the WAP mobile phone screen. First display "Welcome to ...", then display "The Nokia Wireless Application Protocol...", and finally display "Tookit!". When displayed, each screen has the title "Tookit Demo". The delay between two adjacent screens is 50, and its unit size is 1/10 second, and the delay is 50, that is, 5 seconds.
Previous page123456Next pageRead the full text