Simple examples of WML and editing, testing methods 1th/2 page _WML Tutorials

Source: Internet
Author: User
Tags tag name
Once the WAP server is established and the WAP browser is installed, we can then use the WML language to write WAP Web pages or applications and debug them through WAP servers and browsers. Starting with this chapter we will systematically learn the WML language, which focuses on the basics of WML languages, and the next chapter provides a comprehensive explanation of the syntax, labels, and rules of WML.
A simple example of 2.1 WML and its editing and testing methods
The Infinite Markup Language WML (Wireless Markup Language) is a language based on the Extensible Markup Language XML (Extension Markup Language), which 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 specifically for wireless device users to provide interactive interface and design, the current version of the 1.1 version. These wireless devices include mobile phones, pagers and personal digital assistants PDA (Personal Digital assistants).
2.1.1 WML and WAP devices
To better understand and use the WML language, developers should have a general understanding of the characteristics and characteristics of the devices used by WML and the devices that support WML.
Generally speaking, the wireless devices used by WML have the following characteristics:
Compared with the ordinary personal computer, the volume is small;
The device has limited memory and its CPU performance is limited;
The communication bandwidth is narrower and the delay is longer.
In the case of mobile phones and PDAs, devices supporting WML have the following characteristics:
There is a display screen that can display 2. The fierce site  gnawing 2 characters; 2.  type Ǔ0ūa outfitting δ xin Magnetic サ Bursa School?br> Support the input of numbers and characters;
Support the operator to use arrows or digital buttons to select;
Printable code that supports ASCII;
There are usually two programmable function keys, that is, the Accpet key and the options key, generally arranged in close to the keyboard screen;
There is usually a prev navigation key.
The purpose of the WAP device used in WML is to understand the characteristics of the WML language through the features and characteristics of the WAP device, and to have a general idea of the problems to be solved by WML programming.
2.1.2 using a text editor face to write WML programs
When you write a WAP Web page or application using the WML language, you need to edit it using an editor. As with HTML programming, WML programs are plain file text that can be written using any text editor, such as Notepad in a Windows system. You can also use software such as Nokia WAP Toolkie (for this specific usage will be brought up later in the learning process). Let's first introduce the first method and then introduce the second one.
If you want to use Notepad to write a WML program, you can start the Notepad program on the Windows system by clicking the Start button and then pointing to Programs, attachments, Notepad, and then from the menu that appears. The screen will then appear in its editing window, from which you can enter and write WML programs.
As an example, we can enter the following simple program.
<?xml version= "1.0"?>
<! DOCTYPE WML public "-//wapforun//dtd WML 1.1//en" "Http://www.wapforum.org/DTD/wml_1.1.xml" >
<xml>
<card id= "Card1" title= "title" >
<P>
<!--Write your card implementation here.-->
Hello world!!
</P>
</card>
</xml>
Save it as a Hello.xml file when you have finished losing it. Note that the file name extension should be XML instead of TXT when saving.
2.2 WML Program Structure
In the previous section we degraded a simple WML program, and readers with HTML programming can see that the WML program has much in common with the HTML program in its structural form. Here we will analyze the structure and composition of the WML program based on an example.
Elements and labels for 2.2.1 WML
Before analyzing an instance, it is necessary to briefly explain the elements and tags of WML. Like HTML, the main syntax for WML is also elements and tags. Elements are part of a document that conforms to a DTD (document-like definition), such as title (document title), IMG (image), table (table), and so on, and element names are case-insensitive. WML uses labels to specify the attributes of an element and its location in the document. tags are enclosed in the less-than sign (<) and greater-than (>), which is in the form of "< tag name >". Labels are divided into separate labels and pairs of labels that appear. Most labels appear in pairs, consisting of a first and a trailing label. The first and end labels are also called starting and ending labels, respectively. The first label format is "< element name >", and the tail label is formatted as "</element name >". A pair of labels is used to specify the range of elements, which is used to define the range of boldface characters than the?lt;b> and </b> labels, that is to say, the parts that are wrapped between <b> and </b> are shown in bold text. The individual label is formatted as "< element name/>", and his role is to insert the element at the appropriate position. A 〈br/〉 label indicates that a newline character is inserted where the label is located.
An example analysis of structure form and composition of 2.2.2 WML program
After understanding the above knowledge, we are analyzing an instance program below. The procedure is as follows:
<?xml version= "1.0"?>
<! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "Http://www.wapfourm.org/DTD/wml_1.1.xml" >
<wml>
<card id= "Card1" ontimer= "#card2" title= "Tookit Demo" >
<timer value= "/>"
<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= "/>"
<p align= "center" >
<br/><br/>
<b>
The nokia<br/>
</b>
Wireless Application Protocol
</u>
...
</p>
</card>
<card id= "Card3" title= "Toolkit Demo" >
<p align= "center" >
<br/><br/><br/>
<big>
<i>
Toolkit
</i>
</big>
</p>
</card>
</xml>
After the program is running, it will display 3 screen information in the WAP phone screen in turn. First show "Welcome to ..." and then display "The Nokia Wireless application Protocol ..." and finally "tookit!". Display each screen has a title "Tookit Demo", the adjacent two screens between the delay of 50, the unit size of 1/10 seconds, the delay of 50 or 5 seconds.
From the above examples we can understand the structure and composition of the WML program:
1) syntax. WML is very similar to HTML. is still a markup language, and continues the syntax rules of XML, the specific syntax we will encounter later in the learning process.
2) file declaration. All WML programs must declare the XML file type at the beginning of the file, including the version of XML, the document type of WML, the specification used, and so on. The form of the Declaration is as follows:
<?xml version= "1.0" >
<! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "Http://www.wapforum.org/DTD/wml_1.1.xml" >
3) label. The use of tags (tag) in WML languages is exactly the same as in the form of markup languages such as HTML and XML.
4) element. The elements of WML (element) are used to describe the tag information of the card Group (Deck), which is the structure information. An element usually consists of a first label, content, other elements, and a tail tag, which has one of two structures:
< first label > content </Tail label >
Or
< label/>
Elements can also be included in an element, which is also composed of a first label, corresponding content, other elements, and a tail tag. Elements that do not contain content become empty elements. It is a separate label. Alternatively, a separate label is an element.
5) attribute. WML, like XML, has a label that can contain many properties. property is used to provide the necessary additional information to the label, and the property content is usually used within the start tag. However, the property content is not displayed by the browser, and it provides the necessary information as a parameter for the label.
When you indicate a property value, you need to enclose the value in quotation marks, either single or double quotes, which are usually nested in pairs. The property name must be lowercase. For example: <card id= "card 1" ontimer= "#card2" title= "Toolkit Demo" >
Also, the properties of single quotes can contain double quotation marks. Entity characters can also be property values. Entity characters refer to special characters such as &, <, >, ', ', and display the class characters in a WML program that require special handling, followed by a specific method.
6) Notes. Annotations can also be added to the WML program. Annotation content is used to facilitate developers to read the source code smoothly, it will not be displayed by the browser. The annotation content is tagged with an exclamation point (! ) and used in the form of <!--annotation content-->. For example:<!--Write your card implementation here.-->. It is necessary to note that annotations are not nested in XML programs.
7) Document structure. WML documents are composed of "card" and "card Group (Deck)", and a Deck is a collection of one or more cards. When a client makes a request, WML sends the deck from the network to the client browser, which allows the user to browse all the card contained within the deck without having to download each card separately from the Web, the first card in the program is the default card that is visible.
Note: Deck is the meaning of a deck of cards, this is a stack of cards, so we call it the "card group" here. In addition, card refers to the WAP phone screen size of the page, although sometimes a card may require multiple screens to display, but we can also translate it to "page", but this is easy to mix with the pages in HTML. So here we call it a card.
Current 1/2 page 12 Next read the full text

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.