WML is a markup language based on XML (Extended Markup Language). This language is designed to provide interactive interfaces for wireless device users. These wireless devices include telephones, pagers, personal digital assistants, etc.
WML is designed for devices with the following characteristics:
Small size (relative to personal computer).
Limited memory and CPU size.
The communication bandwidth is narrow and time-extended.
Devices that support WML are now roughly divided into two categories:
The feature of a phone is that it has only 4 to 10 lines of text screen. The user enters through the buttons of the phone.
Personal Digital Assistant (PDA) is characterized by its ability to support 100×100 resolution (or better). Users can enter through keyboard, mouse or handwriting.
Now we are looking forward to other handheld devices also supporting WML.
Because WML supports many devices with different functions, the documentation lists the functions or reference devices that these devices should at least have. The reference equipment has the following characteristics:
There is a display screen that can display 4 lines of characters, with 12 characters per line. Includes the line that is reserved for the function button.
Printable codes that support ASCII.
Supports input of numbers and characters.
Supports selection using arrows or numeric buttons.
Two programmable function keys, ACCEPT and OPTIONS, are displayed under the screen close to the keyboard.
A PREV navigation key.
Supports vertical scrolling arrow keys.
Support horizontal scrolling (not using line wrap).
--------------------------------------------------------------------------------
Character Set WML uses XML's character set? That is, the current common character set ISO/IEC-10646 (Unicode 2.0) and supports subsets of other series (for example: US-ASCII, ISO-8859-1 or UTF-8). It is not necessary to use the entire Unicode (UCS-4) encoding unless the UTF-8 encoding is not used.
Case sensitivity Unlike HTML, WML is a case-sensitive language. All tags, attributes, and enum properties must be lowercase. When writing WML pages, you must pay attention to upper and lower case. The name of the parameter and the value of the parameter are case sensitive. For example: variable1, Variable1 and variable1 are all different parameters.
Characters not displayed Table 3-2 includes characters not displayed in WML:
Table 3-2 Characters not displayed
Characters 8-bit decimal value
Line break 10
Enter 13
Space 32
Horizontal tab 9
Unless otherwise specified, WML converts one or more consecutive line breaks, carriage returns, horizontal tabs and spaces into one space. In other words, all more than one character is ignored.
Example 1: <wml><card><p>Some text</p></card></wml>
Example 2: <wml>
<card>
<p>
Some text
</p>
</card>
</wml>
In the above example, manual use of line wraps and carriage return ensures readability of the program, but is not very necessary.
File opening statement All WML pages must declare XML file type at the beginning of the file:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "/DTD/wml_1.">
In order to automatically add this opening remark to the page, readers can implement it using function calls.
Note: To determine the type and version of the WAP browser, it can be done by capturing USER_AGENT in the HTTP header.
ContentType In order to establish a valid WML information entity (MIME type), the file type must be specified before the opening statement of the file:
Content-type: text/
Note: A blank line must be kept (at least) before Content Type and XML file declarations. If omitted, a compiler error will be caused. Too many blank lines can also cause errors.
Attributes Many WML tags have one or more attribute tags, some are required and some are optional. Attributes can specify additional information to determine how the device interprets these tags. There are two ways to use WML tags:
<element a1="value1" a2="value2" ...> content </element>
<element a1="value1" a2="value2" .../>
The attribute value must be included in pairs of single or double quotes, separated by spaces between each attribute.
Quoting variables Much like Shell variables under UNIX, variables can be used in formatted text, URLs, selected text and other text content.
The syntax for using variables is as follows: $(myvar).
Special characters: reserved characters of WML: "<", ">", "'", "" and "&". In order to display these characters in text, they must be specified in the manner specified in Table 3-3.
Table 3-3 Specify special characters
Characters specify the method
<<
>>
‘'
""
&&
$$$
Continuous spaces
-­
A semicolon is a part of a character label and cannot be omitted. If omitted, it may cause WML compiler errors.
Note: Unlike HTML, when using & in URLs, you must use & instead of characters &.
WML uses XML document character sets and currently supports Unicode 2.0. Unlike HTML, all tags, properties and specified enum values of WML must be lowercase. Card names and variables are also case sensitive. Like HTML, only one space is displayed for consecutive null characters. The values of attributes in the label must be enclosed in double or single quotes. There cannot be spaces between attribute names, equal signs and values. For labels that appear in pairs, "/" must be added before ">". For example:<br/>. References to variables are basically the same as HTML, and there are three forms:
$(var1:esc)
$(var1:noesc)
$(var1:unesc)
For three forms, please refer to the relevant part of HTML for specific meanings. The processing of reserved characters is basically the same. For the corresponding replacement characters, please refer to "Character Entity". It should be pointed out here that during the URL delivery process, the & used to connect parameters must be converted into &.
General format of wml file:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "/DTD/wml_1.">
<wml>
<head>
<access/>
<meta..../>
</head>
<card>
Some contents...
</card>
<wml>
The structure looks very similar to an HTML file. For each page, the following type declaration must be specified at the beginning of its document:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "/DTD/wml_1.">
Pay attention to the upper and lower case of letters. For a page, the file size should not exceed 1.2K.
The <wml> tag is the same as the <html> tag in HTML, and is used to indicate that this is a WML page. It has an optional "xml:lang" attribute to formulate the language of the document, for example <wml xml:lang="zh"> means that the document language is Chinese.
Like HTML, the <head> tag contains relevant information about the page. The <head> tag can contain one <access> tag and multiple <meta> tags.
<access domain="domain" path="/path" /> is equivalent to the <BASE> tag in HTML, specifying the access control information of the page. It uses two optional attributes, domain is used to specify the domain, the default value is the current domain; path is used to specify the path, the default value is "/", that is, the root directory. Since <access> is used alone, it should be ended with "/". I will not repeat it in the future for similar situations.
<meta attribute content="value" scheme="format" forua="true|false"/> is similar to that in HTML, providing meta information for this page. Attributes are required, including the following three cases:
name="name" Server ignores meta data.
http-equiv="name" Server converts meta data into HTTP response headers (same as HTML).
user-agent="agent" Server directly transmits meta data to mobile phone devices.
The content attribute is also required, and its content depends on the attribute. The scheme attribute is not currently supported. forua is an optional attribute, specifying whether the <meta> tag is deleted by the intermediate proxy before the wml file is transmitted to the client (because the transmission protocol may change), the default value is false.
WML is designed for devices with the following characteristics:
Small size (relative to personal computer).
Limited memory and CPU size.
The communication bandwidth is narrow and time-extended.
Devices that support WML are now roughly divided into two categories:
The feature of a phone is that it has only 4 to 10 lines of text screen. The user enters through the buttons of the phone.
Personal Digital Assistant (PDA) is characterized by its ability to support 100×100 resolution (or better). Users can enter through keyboard, mouse or handwriting.
Now we are looking forward to other handheld devices also supporting WML.
Because WML supports many devices with different functions, the documentation lists the functions or reference devices that these devices should at least have. The reference equipment has the following characteristics:
There is a display screen that can display 4 lines of characters, with 12 characters per line. Includes the line that is reserved for the function button.
Printable codes that support ASCII.
Supports input of numbers and characters.
Supports selection using arrows or numeric buttons.
Two programmable function keys, ACCEPT and OPTIONS, are displayed under the screen close to the keyboard.
A PREV navigation key.
Supports vertical scrolling arrow keys.
Support horizontal scrolling (not using line wrap).
--------------------------------------------------------------------------------
Character Set WML uses XML's character set? That is, the current common character set ISO/IEC-10646 (Unicode 2.0) and supports subsets of other series (for example: US-ASCII, ISO-8859-1 or UTF-8). It is not necessary to use the entire Unicode (UCS-4) encoding unless the UTF-8 encoding is not used.
Case sensitivity Unlike HTML, WML is a case-sensitive language. All tags, attributes, and enum properties must be lowercase. When writing WML pages, you must pay attention to upper and lower case. The name of the parameter and the value of the parameter are case sensitive. For example: variable1, Variable1 and variable1 are all different parameters.
Characters not displayed Table 3-2 includes characters not displayed in WML:
Table 3-2 Characters not displayed
Characters 8-bit decimal value
Line break 10
Enter 13
Space 32
Horizontal tab 9
Unless otherwise specified, WML converts one or more consecutive line breaks, carriage returns, horizontal tabs and spaces into one space. In other words, all more than one character is ignored.
Example 1: <wml><card><p>Some text</p></card></wml>
Example 2: <wml>
<card>
<p>
Some text
</p>
</card>
</wml>
In the above example, manual use of line wraps and carriage return ensures readability of the program, but is not very necessary.
File opening statement All WML pages must declare XML file type at the beginning of the file:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "/DTD/wml_1.">
In order to automatically add this opening remark to the page, readers can implement it using function calls.
Note: To determine the type and version of the WAP browser, it can be done by capturing USER_AGENT in the HTTP header.
ContentType In order to establish a valid WML information entity (MIME type), the file type must be specified before the opening statement of the file:
Content-type: text/
Note: A blank line must be kept (at least) before Content Type and XML file declarations. If omitted, a compiler error will be caused. Too many blank lines can also cause errors.
Attributes Many WML tags have one or more attribute tags, some are required and some are optional. Attributes can specify additional information to determine how the device interprets these tags. There are two ways to use WML tags:
<element a1="value1" a2="value2" ...> content </element>
<element a1="value1" a2="value2" .../>
The attribute value must be included in pairs of single or double quotes, separated by spaces between each attribute.
Quoting variables Much like Shell variables under UNIX, variables can be used in formatted text, URLs, selected text and other text content.
The syntax for using variables is as follows: $(myvar).
Special characters: reserved characters of WML: "<", ">", "'", "" and "&". In order to display these characters in text, they must be specified in the manner specified in Table 3-3.
Table 3-3 Specify special characters
Characters specify the method
<<
>>
‘'
""
&&
$$$
Continuous spaces
-­
A semicolon is a part of a character label and cannot be omitted. If omitted, it may cause WML compiler errors.
Note: Unlike HTML, when using & in URLs, you must use & instead of characters &.
WML uses XML document character sets and currently supports Unicode 2.0. Unlike HTML, all tags, properties and specified enum values of WML must be lowercase. Card names and variables are also case sensitive. Like HTML, only one space is displayed for consecutive null characters. The values of attributes in the label must be enclosed in double or single quotes. There cannot be spaces between attribute names, equal signs and values. For labels that appear in pairs, "/" must be added before ">". For example:<br/>. References to variables are basically the same as HTML, and there are three forms:
$(var1:esc)
$(var1:noesc)
$(var1:unesc)
For three forms, please refer to the relevant part of HTML for specific meanings. The processing of reserved characters is basically the same. For the corresponding replacement characters, please refer to "Character Entity". It should be pointed out here that during the URL delivery process, the & used to connect parameters must be converted into &.
General format of wml file:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "/DTD/wml_1.">
<wml>
<head>
<access/>
<meta..../>
</head>
<card>
Some contents...
</card>
<wml>
The structure looks very similar to an HTML file. For each page, the following type declaration must be specified at the beginning of its document:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "/DTD/wml_1.">
Pay attention to the upper and lower case of letters. For a page, the file size should not exceed 1.2K.
The <wml> tag is the same as the <html> tag in HTML, and is used to indicate that this is a WML page. It has an optional "xml:lang" attribute to formulate the language of the document, for example <wml xml:lang="zh"> means that the document language is Chinese.
Like HTML, the <head> tag contains relevant information about the page. The <head> tag can contain one <access> tag and multiple <meta> tags.
<access domain="domain" path="/path" /> is equivalent to the <BASE> tag in HTML, specifying the access control information of the page. It uses two optional attributes, domain is used to specify the domain, the default value is the current domain; path is used to specify the path, the default value is "/", that is, the root directory. Since <access> is used alone, it should be ended with "/". I will not repeat it in the future for similar situations.
<meta attribute content="value" scheme="format" forua="true|false"/> is similar to that in HTML, providing meta information for this page. Attributes are required, including the following three cases:
name="name" Server ignores meta data.
http-equiv="name" Server converts meta data into HTTP response headers (same as HTML).
user-agent="agent" Server directly transmits meta data to mobile phone devices.
The content attribute is also required, and its content depends on the attribute. The scheme attribute is not currently supported. forua is an optional attribute, specifying whether the <meta> tag is deleted by the intermediate proxy before the wml file is transmitted to the client (because the transmission protocol may change), the default value is false.
123Next pageRead the full text