The best way to learn natural language in a tutorial is to dissolve into the corresponding language environment and learn from the communication, the best way to learn a programming language is to look at routines. To help create a first impression of WML applications, let's take a look at the first example:
>
"Http://www.wapforum.org/dtd/wml_1.1.xml" >
!--provide a button you can clink a step-->
sina WAP
next card
This is the second card.
From the above example, you should know the following:
1, Syntax: WML syntax is similar to HTML, is still a markup language, and continues the XML syntax rules
2. Elements: in XML and WML languages, the basic elements of a language are called "tags."
Labels must be enclosed in the.
Most labels include the "Up" and "Stop" sections, for example:
...
Some special tags can have only one label, but must have an end tag, for example:
3, Attributes: XML language tags can contain many attributes, to provide the necessary additional information to the label
Property content is usually used within the start tag
Property only provides the necessary information for the label as a parameter and is not displayed by the browser
The value of the property needs to be enclosed in quotation marks, either single or double quotes, which can be nested using
For example:
4, Notes
Annotation content is convenient for the creator to read the source code, 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, and a deck is a collection of one or more card. After receiving a client terminal request, WML sends deck from the network to the customer's browser, and visitors can browse through all the card included in the deck without having to download each card individually from the web.
Some of the other examples don't include the basics:
6, Case sensitive
Both the label element and the property content are case-sensitive, which inherits the strict nature of XML, and any capitalization errors can cause access errors, a problem that WML producers must pay attention to.
7, evade the grammar examination method-cdata
CDATA The contents of the data are treated as text, bypassing the grammar checker and displaying it directly as text.
Example:
! [CDATA [This IA a test]] >
Display results as
This IA a test
8. Define Variables
WML can use variables for browsers and script use, and by setting a variable on a card in deck, the other card can be invoked directly without having to reset it.
The syntax for the variable is as follows:
$identifier
$ (identifier)
$ (identifier:conversion)
If the variable content contains spaces, it needs to be enclosed in parentheses. Because variables have the highest precedence in syntax, strings containing variable declaration characters are treated as variables, so if you want to display $, you must use two $ in a row.
Example:
Your account has $$15.00 in it.
Display Result: Your account has $15.00 in it
XML is a language that is very strict in syntax, and WML inherits this rule, and any nonstandard syntax can lead to errors.