WML language Learning notes-basic tutorials (GO)

Source: Internet
Author: User
Tags lowercase range tag name

WML language Learning notes-basic tutorials
A camel has always felt that learning is the greatest pleasure in life. Even though some camel is still food. Years ago learned css+div typesetting, some camel feel very fruitful. At one time, I was complacent about ing because I mastered a skill in a short period. However, since the end of the joy of looking at the learning process, we found that their learning process revealed the lack of more shocking. The first is because the learning time is short, some of the essence of things can not understand, the details of the place also lack of attention. So when the work comes out, let the master a look at the pick out the problem. And then it's expansion. Any learning skill is not independent. Css+div typesetting is part of the web2.0 standard, and its learning and web2.0 should be closely combined. Apart from the standard of web2.0, simple css+div meaning is not very small. So, when I was studying css+div, how much did the other parts of web2.0 notice? So, although the short css+div typesetting study has passed, Css+div's road is still very long. How much more can I grow in WML learning that has just begun?Introduction to WML:
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 the XML. It can display a variety of text, images and other data, is presented by the WAP Forum (http://www.wapforum.org) and designed for the wireless device users to provide an interactive interface, the current version is 1.1 edition. These wireless devices include mobile phones, pagers and personal digital assistants PDA (Personal digital assistants).
Editor
When you write a WAP Web page or app in WML, you need to edit it with an editor. As with HTML programming, the WML-written program is also plain file text and can be written using any text editor. Some of the Sims used by some of the simulator, such as Nokia provided in addition to the display is usually also with editing features, easy to write at any time to view. The extension name of a WML file can be. WML or. Xml. Of course, you can also use. php,.asp,.jsp, WML pages can also be directly mixed with. php,.asp,.jsp code. Of course, this needs to be configured from the server side of the said.basic knowledge of language Like HTML, the primary 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 the element names are not case-sensitive. WML uses tags to specify the attributes of an element and its position in the document. Labels are enclosed in less than (<) and greater than (>), which is the form of "< tag name >". Labels appear in separate labels and paired labels. Most labels are paired and consist of a first label and an end tag. The first and end labels are also referred to as the start tag and the end tag. The first label is in the format "< element name >" and the tail label is in the format "</element name >". A paired label is used to specify the range of elements, such as the <b> and </b> tags used to define the range of boldface characters, meaning that the portion of the package between <b> and </b> is shown in bold. The format of the individual label is "< element name/>", and his role is to insert the element in the appropriate position. A 〈br/〉 tag indicates that a newline character is inserted where the label is located.
The above paragraph for the skilled Master of HTML is basically nonsense.
Basic noun Explanation:
Elements: WML elements (Element) are used to describe the tag information of a deck (Deck) as structure information. An element usually has a first label, content, other elements, and a tail tag, with one of the following two structures:
< first label > content </end tag > or < tag/>
Elements can also contain elements that have a header tag, corresponding content, other elements, and tail tags. An element that does not contain content becomes an empty element. It is a separate label. Or, a separate label is an element.
Properties: WML is like XML, its label can contain many attributes. 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, it provides the necessary information for the label as a parameter. When specifying a property value, you need to enclose the value in quotation marks, which can be either single or double quotes, which are usually used in pairs of nested quotes. Property names must be lowercase. For example: <card id= "card 1" ontimer= "#card2" title= "Toolkit Demo" > Also, the properties of single quotation marks can contain properties of double quotes. Entity characters can also be used as attribute values. Entity characters are special characters, such as &, <, >, ', ', which display class characters in a WML program and require special handling, followed by specific methods.
This step is also easy to annotate with HTML: Annotations can also be added to WML programs. Note content is useful for developers to easily read the source code, which is not displayed by the browser. The comment content is in the label with an exclamation mark (. ) and used in the form of <!--annotation content. For example:<!--Write your card implementation here.-->.   It should be noted that the nesting of annotations is not supported in XML programs. Document structure: WML documents are composed of "card" and "card Group (Deck)", and one Deck is a collection of one or more card. When a client makes a request, WML sends deck to the client's browser from the network, where the user can browse all the card contained within the deck, and the switch between the card is handled by the client's processor. So you do not have to download each card from the Internet, the first card in the program is the default card that is visible.
the basic structure of the WML programThe following is the basic structure of WML <?xml version= "1.0"?>
<! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "Http://www.wapforum.org/DTD/wml_1.1xml" >
<wml>
<access/>
<meta..../>
<card>
Some contents ...
</card>
<wml>
The basic structure can be divided into the following key sections: 1) declaration. The WML program has many deck components, and for each deck, the declaration of XML and the document type DOCTYPE must be declared at the beginning of its document. The XML declaration is always in the first line of the file, note that it is best not to have a space or line: <?xml version= "1.0"?>
2) Following is the DOCTYPE statement, notice that the letter is the case of the capitalization do not mistake: <! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "Http://www.wapforum.org/DTD/wml_1.1xml" > This is the legendary file statement. Starting with XHTML All WML programs must declare the XML file type at the beginning of the file, including the version of the XML, the WML document type, the specification used, and so on. You open all of the WML documents, which must be the beginning of the sentence. And for a long period of time, this line will not change a single punctuation mark.   3) <wml> tags. This label is used to include and define a deck for WML. It has an optional Xml:lang property to develop the language of the document, such as &LT;WML xml:lang= "zh" > indicates that the document language is Chinese. However, this is a very frustrating practice, because even if the xml:lang= "zh", many WAP browsers still do not support Chinese, the most foolproof method is to convert Chinese characters into Uincode encoding. So, to find a coder, that would be very useful. There may be a WML editor that can be converted directly, and it's not necessarily a camel. WML also supports a subset of the set of characters for other series, such as UTF-8, iso-8859-1, or UCS-2. By the way: <?xml version= "1.0" encoding= "gb2312" > is also a means of representing the document language as Chinese, however it is no more effective than <wml xml:lang= "zh" >. 4) WML characters use basic rulesWML is a more rigorous language, and character usage must follow the rules, which mainly include the following:

1) Case sensitive. In WML, both the label element and the property content are case-sensitive, which inherits the strict nature of XML, and any case error can result in an access error.
In general, all tags, attributes, rules, and enumerations of WML and their acceptable values must be lowercase, card names and variables can be uppercase and lowercase, but it is case-sensitive.  Both the name of the parameter and the value of the parameter are case sensitive, such as Variable1, Variable1, and vaRiable1 are different parameters. 2) space. For consecutive null characters, only one space is required for the program to run. There cannot be spaces between property names, symbols (=), and values.

3) label. The value of the attribute within the tag must be enclosed in double quotation marks (") or single quotation marks ('). For a label that does not appear, you must precede the greater than (>) with a forward slash (/), such as a newline label that must be written <br/> correctly.

4) content that is not displayed. In WML, characters that are not displayed mainly include line breaks, carriage returns, spaces, and horizontal tabs, and their 8-digit hexadecimal inner codes are 10, 13, 32, and 9, respectively. When the program executes, WML ignores all more than one non-display character, that is, WML converts one or more consecutive lines of newline, carriage returns, horizontal tabs, and spaces into an empty one.

5) reserved characters. This is some special characters of WML, such as less than (<), greater than (>), single quote "'", double quotation mark "" ", and Number (&).variables

Variables can be used in WML programming, and variables must be defined before they are used. Once a variable has been defined on a card in deck, the other card can call the variable without having to redefine it.
The syntax format for defining variables is:
$identifier
$ (identifier)
$ (identifier:conversion)
Where identifier refers to variable names, or variable identifiers; conversion refers to the substitution of variables.
Variable names are made up of us-acsii codes, underscores, and numbers, and can only begin with a us-acsii code. Variable names are strictly case-sensitive, that is, the variable names are case-insensitive.
The syntax for defining variables enjoys the highest interpretation precedence in WML.
The instructions for using variables are as follows:
1) in WML, a variable can be used in a string, and the value of a variable can be updated in a run.
2) When the variable is equal to an empty string, the variable is left in an undefined state, which is empty (null).
3) When a variable is not equal to an empty string, the variable is in the set state, which is the non-null (NOT NULL) state.
4) in the "$identifier" form, WML usually represents the end of the variable name with a space after the variable name. If, in some cases, a space cannot represent the end of a variable name, or if the variable name contains spaces, you must enclose the variable name in parentheses, which is in the form of "$ (identifier)".
A variable in a WML program can be substituted, and we can assign the value of a variable to a text in the card. The variable substitution instructions are as follows:
1) in a WML program, only the text part can be substituted.
2) overrides typically occur at run time, and overrides do not affect the current value of the variable.
3) Any tag is implemented in the form of a string substitution.
4) substitution is implemented in the form of a string substitution.

Since the variable has the best precedence in the syntax, the string containing the variable declaration character will be treated as a variable, so if you want the program to display "___fckpd___0rdquo; symbols, you need to use two consecutive" ___fckpd___0rdquo; For example:<p> Your acconut have $15.00 in it </p> a sentence that shows the result: Your account had $15.00 in it.
Card and card sets

Before we analyzed the structure of the WML program, the information about the WML document was organized in the form of a card set and a set of card sets. A deck is a collection of one or more card. When a client terminal makes a request, WML sends deck to the client's browser from the network, and deck is the smallest unit of information sent by the server. Once the user's browser receives deck, you can browse through all the card contained therein. Card is used to represent or describe one or more user interaction units.Card Group Templates

The same card group usually contains many cards, and the definitions, attributes, or formats of these cards are usually similar. If we define each card individually, it is obviously very troublesome. To this end, WML provides the functionality of the deck template, which defines a set of criteria and parameters that can be applied to all cards in the same deck, thus greatly improving our programming efficiency. We'll cover the contents of the deck template later.
  OK, knowing all of this, the basics of WML are over.
Related Article

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.