WML basic tutorial

Source: Internet
Author: User
The best way to learn a natural language is to integrate the corresponding language environment to learn in communication. The best way to learn a programming language is to look at routines. To help you build the first impression of wml applications, let's take a look at the first example: the best way to learn a natural language is to integrate the corresponding language environment for communication, the best way to learn a programming language is to look at routines. To help you build the first impression of the wml application, let's take a look at the first example:

<?xml version="1.0"?><!doctype wml public "-//wapforum//dtd wml 1.1//en""http://www.wapforum.org/dtd/wml_1.1.xml"><wml> <template>   <do type="PRev" label="back">     <prev/>     <!--provide a button you can clink to back a step-->   </do> </template><card id="friends" title="hot link"> <p>   <a href="http://wap.sian.com.cn/">sina wap</a><br/>   <a href="#nextcard">next card</a> </p></card><card id="nextcard"> <p>  this is the second card. </p></card></wml>

Through the above examples, you should understand the following:

1. Syntax: similar to html, wml is still a markup language and extends xml syntax rules.

2. elements: in xml and wml languages, the basic elements of a language are called "tags"

Tags must be <and>.
Most tags have two parts: <p>... </P>
Some special labels can have only one label, but must have an end tag, for example: <prev/>

3. attributes: labels in xml can contain many attributes and provide necessary additional information for tags.

Attribute content is usually used in the start label
The property is only used as a parameter to provide necessary information for the tag and will not be displayed by the browser.
Attribute values need to be enclosed by quotation marks, which can be single or double quotation marks. quotation marks can be nested in pairs.
For example:

<card id="friends" title="hot link">

4. Notes

The comment content is easy for the producer to read the source code and will not be displayed by the browser.
Wml does not support annotation nesting
For example:

<!-- this is a comment. -->

5. document structure

Wml documents are composed of card and deck. a deck is a collection of one or more cards. After receiving a request from the client terminal, wml sends the deck to the client's browser from the network. visitors can browse all the cards contained in the deck without downloading each card from the Internet.

Basic content not involved in other examples:

6. Case Sensitive

Both label elements and attribute content are case-sensitive. This inherits the strict characteristics of xml, and any case-sensitivity errors may cause access errors. this is a must-note issue for wml producers.

7. syntax check avoidance method-cdata

The data content in cdata is processed as a text, which avoids syntax check and is directly displayed as text.

Example:

  

< ! [ cdata [ this ia <b> a test ] ] >

The result is

This ia <B> a test

8. Define variables

Wml can use variables for browsers and scripts. by setting variables on a card in deck, other cards can be called directly without being reset.

The syntax of the variable is as follows:

  

$identifier   $(identifier)   $(identifier:conversion)

If the variable contains spaces, enclose them in parentheses. Because the variables have the highest priority in syntax, strings containing variable declaration characters are treated as variables. therefore, to display $, you must use two $ pairs consecutively.

Example:

  

<p> your account has $$15.00 in it.</p>

The result is as follows:

your account has $15.00 in it

Xml is a language with very strict syntax. wml also inherits this rule, and any non-standard syntax will cause errors.

The above is the basic WML tutorial to learn about WML content from practical applications. For more information, see PHP Chinese website (www.php1.cn )!

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.