Simple examples and compilation and testing methods of WML

Source: Internet
Author: User
After the establishment of the WAP server and the installation of the WAP browser, we can use the WML language to compile or use the WAP web page and debug it through the WAP server and browser. Starting from this chapter, we will systematically learn the WML language.

After the establishment of the WAP server and the installation of the WAP browser, we can use the WML language to compile or use the WAP web page and debug it through the WAP server and browser. From the beginning of this chapter, we will systematically learn the WML language. This chapter focuses on the basic knowledge of the WML language. the next chapter will comprehensively explain the syntax, labels, and rules of WML.

Simple examples and compilation and testing methods of 2.1 WML

Wireless Markup Language (WML) is a Language based on Extension Markup Language (XML). It is a subset of XML. It can display a variety of text, images and other data, is proposed by the WAP Forum (http://www.wapforum.org) and designed for wireless device users to provide interactive interface, the current version is 1.1. These wireless devices include mobile phones, pagers, and Personal Digital assistant PDAs (Personal Digital Assistants.

2.1.1 WML and WAP devices

In order to better understand and apply the WML language, developers should have a rough understanding of the features and features of the WML application devices and the devices supporting WML.

Generally, wireless devices of WML applications have the following features:

Compared with ordinary personal computers, it is smaller in size;
The device memory is limited, and its CPU performance is also limited;
The communication bandwidth is narrow and the latency is long.

Taking mobile phones and PDAs as an example, devices supporting WML have the following characteristics:

There is a display screen that can display 2. what are the targets ?? Chew? 2 characters each; 2. what are the malicious addresses? Type limit 0? When A problem? ? Br> supports inputting numbers and characters;
Apply arrows or numeric buttons to the support controllers;
Printable ASCII code;
Usually there are two programmable function keys, the Accpet key and the Options key, which are usually arranged below the screen near the keyboard;
Usually there is a Prev navigation key.

The goal of applying WAP devices to WML is to understand the characteristics and features of WML language, then, I am familiar with the title to be solved in WML programming.

2.1.2 use the text editor to write the WML program

When you use the WML language to compile WAP web pages or use them, you need to use a compiler to compile them. Like HTML programming, WML programs are also pure file text, which can be written by any text editor, such as "NotePad" in Windows. You can also use software such as Nokia WAP Toolkie (the specific usage will be mentioned later ). Let's first introduce the first method and then the second method.

If you want to use 'notepad (NotePad) 'to write WML programs, you can click the "start" button in the Windows system, and then from the displayed menu, point the cursor to "program", "attachment", and "notepad" in sequence, and start the "notepad" program. The screen will then display its compilation window, from which you can input and write the WML program.

For example, we can enter the following simple program.









Hello World !!





After the input, save it as a hello. xml file. Note that the extended name of the file should be xml rather than txt.

2.2 WML program structure

In the previous section, we degraded a simple WML program. readers with HTML programming can see that the WML program has many similarities with the html program in terms of structure. Next we will analyze the structure and composition of the WML program based on an example.

2.2.1 WML elements and labels

Before analyzing an instance, it is necessary to briefly clarify the elements and labels of WML. Similar to HTML, WML syntax is also an important element and tag. An element is a part of a document that complies with a DTD (similar to a document definition), such as title, IMG, and table. the element name is case insensitive. WML uses labels to specify the attributes of an element and its position in the document. Label applications are enclosed by signs (<) and greater than signs (>), that is, <标签名> "The situation. Tags are divided into two types: individually rendered tags and pairs rendered tags. Most tags are displayed in pairs, consisting of the first tag and the last tag. The start and end tags are also known as the start and end tags. The first tag is" <元素名> ", The tail label pattern is" ". Pair tags are used to specify the category of an element? Lt; B> andTags are used to define the category of the Italic, that is AndThe enclosed parts are displayed in italics. The pattern of a single tag is" <元素名 />", His role is to insert elements in the corresponding position. For example, the <br/> label inserts a line break into the location of the tag.

2.2.2 analysis of WML program structure and composition examples

After understanding the above knowledge, we are analyzing an instance program. The procedure is as follows:















Welcome ....












The Nokia


Wireless Application Protocol

...












Toolkit







After the program runs, three screens are displayed on the WAP mobile phone screen. 'Welcome to... 'is displayed first, 'The Nokia Wireless Application Protocol...' is displayed, and 'tookit! '. The title 'tookit Demo' is displayed on each screen. the latency between two adjacent screens is 50. the unit size is 1/10 seconds, and the latency is 50 or 5 seconds.

Through the above examples, we can understand the structure and composition of the WML program:

1) syntax. WML is very similar to HTML. It is still a markup language and continues the XML syntax rules. we will encounter the specific syntax in the future.

2) file declaration. All WML programs must declare the XML file type at the beginning of the file, including the XML version, WML document type, usage specification, and so on. The statement is as follows:




3) labels. In the WML language, tags must be applied. the application situation is consistent with that in the HTML and XML markup languages.

4) element. The Element of WML is used to describe the tag information of the card group (Deck), that is, the structure information. An element usually consists of a first tag, content, other elements, and a tail tag. it has one of the following two structures:

<首标签> Content
Or
<标签 />

Elements can also be contained in the content. these elements are also composed of the first tag, corresponding content, other elements, and the last tag. The element that does not contain the content becomes an empty element. It is a separate label. Or, a separate tag is also an element.

5) attributes. Like XML, WML labels can contain many attributes. Attributes are used to provide necessary additional information to tags, and the attribute content is usually applied within the start tag. However, the property content is not displayed by the browser. it serves as a parameter to provide necessary information for the tag.

When specifying the attribute value, you need to extend the value with quotation marks, which can be single or double quotation marks. the quotation marks are usually nested in pairs. The property name must be in lowercase. For example:

In addition, single quotes can also contain double quotation marks. Entity characters can also be used as attribute values. Entity characters refer to special characters such as &, <,>, ', and'. special processing is required to display class characters in WML programs.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.