WML Grammar encyclopedia and related introduction 1th/3 page _WML Tutorial

Source: Internet
Author: User
Tags numeric lowercase numeric value reserved
WML is a markup language based on XML (Extensible Markup Language). This language is designed for users of wireless devices to provide an interactive interface. These wireless devices include telephones, pagers and personal digital assistants (Personal Digital assistants), and so on.
WML is designed for devices that have the following characteristics:
Small in size (relative to personal computer).
Limited memory and CPU size.
Communication belt width and time extension.
The devices that now support WML fall into two broad categories:
The phone is characterized by a text screen with only 4~10 lines. The user enters by a button on the phone.
Personal digital Assistant (PDA) is characterized by its ability to support 100x100 resolution (or better). Users can enter through the keyboard, mouse, or handwriting.
It is now expected that other handheld devices will also support WML.
Because WML supports many different devices, the documentation lists the features that are at least functional or reference equipment. Reference equipment has the following characteristics:
There is a display screen that can display 4 lines of characters, 12 characters per line. Includes the line reserved for the function button.
Printable code that supports ASCII.
Supports the input of numbers and characters.
Supports using arrows or numeric buttons to select.
Two programmable function keys, accept and options, and displayed on the screen near the keyboard.
A prev navigation key.
Arrow keys that support vertical scrolling.
Supports horizontal scrolling (not using automatic wrapping).
--------------------------------------------------------------------------------
Character set WML uses XML's character set? That is, the currently used universal Character Set iso/iec-10646 (Unicode 2.0) and supports subsets of other series (for example: Us-ascii, iso-8859-1, or UTF-8). You do not have to use the entire Unicode (UCS-4) encoding unless you are using a UTF-8 encoding.
Case sensitivity is not like HTML,WML is a case-sensitive language. All tags, attributes, and enumeration properties must be lowercase. When writing WML pages, you must be aware of the case. Both the name of the parameter and the numeric value of the parameter are case sensitive. For example: Variable1, Variable1, and vaRiable1 are all different parameters.
Characters not displayed in WML are included in the character chart 3-2 that is not displayed:
Table 3-2 characters that are not displayed
Character 8-bit decimal value
Line Wrap 10
Enter 13
Space 32
Horizontal Tab 9
Unless specifically specified, WML converts one or more consecutive newline, carriage returns, horizontal tables, and spaces into a single space. In other words, ignore all more than one display character.
Example 1:<wml><card><p>some text</p></card></wml>
Example 2:<wml>
<card>
<p>
Some text
</p>
</card>
</wml>
In the above example, the manual use of newline and carriage return to ensure the readability of the program, but not very necessary.
File opening all WML pages must declare the XML file type at the beginning of the file:
<?xml version= "1.0"?>
<! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "Http://www.wapforum.org/DTD/wml_1.1.xml" >
To automatically add this opening to the page, the reader can use a function call to implement it.
Note: To determine the type and version of the Wap browser, you can do so by capturing the User_agent in the HTTP header.
Content type to establish a valid WML information entity (MIME type), you must specify the type of file before the opening of the file:
Content-type:text/vnd.wap.wml
Note: You must (at least) keep a blank line before the content type and XML file declarations. If omitted, a compiler error is caused. Too many empty rows can also cause errors.
Attribute many WML tokens have one or more attribute tags, some are required, and some are optional. property to specify additional information to determine how the device interprets the labels. WML tokens have the following two ways of using:
<element a1= "value1" a2= "value2" ...> content </element>
<element a1= "value1" a2= "value2" .../>
Attribute values must be included in pairs of single or double quotes, separated by spaces between each property.
Reference variables are like shell variables under UNIX, and you can use variables in text content such as formatted text, URLs, selection text, and so on.
The syntax for using variables is as follows: $ (myvar).
Special character WML reserved characters: "<", ">", "" "," "and" & ". In order to display these characters in the text, you must specify them in the manner specified in table 3-3.
Table 3-3 Specifying special characters
Character Designation method
< <
> >
‘          '
"          "
& &
$ $$
Contiguous space
-
A semicolon is a part of a character label and cannot be omitted. If omitted, a WML compiler error may be caused.
Note: Unlike HTML, you must use & instead of character & when using & in a URL.
WML uses the XML document character set and currently supports Unicode 2.0. Unlike HTML, all the labels, attributes, and specified enumeration values for WML must be lowercase. The name and variable of the card are also case-sensitive. As with HTML, only one space is displayed for consecutive null characters. The value of the property within the label must be enclosed in double quotes or single quotes. There must be no spaces between the property name, the equals sign, and the value. For a label that does not appear, you must add "/" Before ">". Like:<br/>. The reference to a variable is essentially the same as HTML, with the following three forms:
$ (VAR1:ESC)
$ (VAR1:NOESC)
$ (VAR1:UNESC)
Three forms, the specific meaning can be seen in the relevant parts of HTML. In the processing of reserved characters is also basically the same, the corresponding alternative characters please see "character entity." It is important to note that the & of the connection parameters must be converted to & during the URL transfer process.
General format for WML files:
<?xml version= "1.0"?>
<! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "Http://www.wapforum.org/DTD/wml_1.1.xml" >
<wml>
<access/>
<meta..../>
<card>
Some contents ...
</card>
<wml>
The structure looks similar to an HTML file, and for each page, the following type declarations must be specified at the beginning of the document:
<?xml version= "1.0"?>
<! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "Http://www.wapforum.org/DTD/wml_1.1.xml" >
Pay attention to the case of letters. For a page, the file size is best not to exceed 1.2K.
<wml> tags, like the Like HTML <access domain= "domain" path= "/path"/> Equivalent to the <BASE> tag in HTML, which specifies the access control information for the page. It uses two optional properties, domain to specify the field, the default value is the current domain; path is used to specify the path, the default value is "/", that is, the root directory. Because <access> is used alone, use the "/" end, and later on the similar situation no longer repeat.
The <meta property content= "value" scheme= "format" forua= "True|false"/> and similar in HTML, provides meta information for the page. Properties are required, including the following three scenarios:
Name= "name" up. Link server ignores meta data.
http-equiv= "name" up. Link server converts Meta data to HTTP response headers (with HTML).
User-agent= "Agent" up. Link server directly passes meta data to mobile devices.
The content attribute is also required and depends on the property. The scheme attribute is not currently supported. Forua is an optional attribute that specifies whether the,<meta> label is removed by the intermediary agent before the WML file is uploaded to the client (because the protocol for the transfer may change) and the default value is False.
Current 1/3 page 123 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.