WML learning 2 Basic Format and File Header

Source: Internet
Author: User

Basic Format and File Header

The general format of wml files:

<? Xml version = "1.0"?>

<! DOCTYPE wml PUBLIC "-// WAPFORUM // dtd wml 1.1 //" http://www.wapforum.org/DTD/wml_1.1.xml ">

<Wml>

<Head>

<Access/>

<Meta.../>

</Head>

<Card>

Some contents...

</Card>

<Wml>

The structure looks like an HTMl file. For each DECK, the following type declaration must be specified at the beginning of the document:

<? Xml version = "1.0"?>

<! DOCTYPE wml PUBLIC "-// WAPFORUM // dtd wml 1.1 //" http://www.wapforum.org/DTD/wml_1.1.xml ">

Pay attention to the Case sensitivity of letters. For a DECK, the file size should not exceed 1.2 kb.

The <wml> label is the same as the <HTML> label in html to indicate that this is a wml deck. It has an optional xml: lang attribute to define the language of the document, for example, <wml xml: lang = "zh"> indicates that the document language is Chinese.

Like HTML, the

<Access domain = "domain" path = "/path"/> is equivalent to the <BASE> tag in HTML, which specifies the access control information of the DECK. It uses two optional attributes, domain is used to specify the domain. The default value is the current domain, and path is used to specify the path. The default value is "/", that is, the root directory. Because <access> is used independently, it must end with a slash (/). We will not repeat similar cases in the future.

<Meta attribute content = "value" scheme = "format" forua = "true | false"/> similar to HTML, the DECK meta information is provided. Attributes are required, including the following three conditions:

Name = "name" UP. Link Server ignores meta data

Http-equiv = "name" UP. Link Server converts meta data into an HTTP Response Header (same as HTML)

User-agent = "agent" UP. Link Server directly transmits the meta data to the mobile phone device. The content attribute is also required and its content depends on the property. The scheme attribute is not currently supported. Forua is an optional attribute that specifies whether the <meta> tag is deleted by the Intermediate proxy before the wml file is uploaded to the client (because the transfer protocol may change). The default value is false.

Currently supported meta data:

<Meta http-equiv = "Cache-Control" content = "max-age = 3600"/> specify the storage period of the DECK in the memory Cache of the mobile phone, the default value is 30 days (unless the memory is exhausted). During this period, the mobile phone calls the accessed DECK directly from the cache. If the information is time sensitive, you can use max-age to specify the lifetime of the DECK in the cache. The minimum unit is seconds. If it is specified as 0, you need to connect to the server to call the DECK each time.

<Meta user-agent = "vnd. up. markable "content =" false "/> and <meta user-agent =" vnd. up. bookmark "content =" specified URL "/> is similar to the bookmarks function of a Common Browser. After a user bookmarks a CARD, the mobile browser first uses a tag to record the CARD. The default tag is the title attribute in the <card> tag (which will be discussed later ), then, after the user selects the bookmarks, the browser will open the recorded URL. However, by default, the mobile phone records all DECK records. Therefore, <meta> is generally used to prevent the mobile phone from recording the current URL, that is

<Meta user-agent = "vnd. up. markable" content = "false"/>. In addition, to specify a URL different from the current DRECk for the bookmarks, use <meta user-agent = "vnd. up. bookmark" content = "specified URL"/>.

A deck can contain multiple cards. The content of each CARD may be displayed on more than one screen. Pay attention to the relationship between DECK, CARD, and display range. A card is included in <card> and </card>. <Card> it can contain the following optional attributes:

<Card id = "name" title = "label" newcontext = "false" ordered = "true" onenterforward = "url" onenterbackward = "url" ontimer = "url">

* The id attribute is used to specify the NAME of a card. It can be used to jump between cards. It is equivalent to <a name = "jumyun"> used to jump to the page in HTML.

* The title attribute is used to mark bookmarks. It is generally not displayed on the screen.

* Newcontext attribute. The default value is false. It indicates whether the phone needs to clear the previously retained information, including variables, historical records in the stack, and resetting the status of the phone when it jumps to the current CARD.

* The ordered attribute. The default value is true, indicating whether the content in the CARD is displayed in a fixed order or by user selection. Unlike HTMl, the content on the CARD page can be displayed in a certain order. By default, the content is displayed in a linear order, that is, in the code order. However, note that, the following three labels must be written in the following order: <onevent> <timer> <do> (this is related to the "event" to be discussed later ). This is done to facilitate table filling. When ordered is set to true, if the content of a form cannot be displayed on a screen, it is divided into multiple screens; when the value of ordered is set to false, the mobile phone can display a summary CARD to summarize the valid options. You can select the form options to fill in.

* The onXXX attribute is similar to the onXXX attribute in the HTML Tag. It is used to capture events. When an event is triggered, the specified operation (task) is executed. Here, it is switched to a URL.

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.