WML Tutorial 8:WML document Structure Xiang Solution

Source: Internet
Author: User
Tags header version domain access to domain
Tutorial

WML Document Structure Xiang Solution
1. Statement (Prologue)
<?xml version= "1.0"?>
<! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "http://www.wapforum.com/DTD/wml_1.1.xml" >

2, elements (Element)
WML first defines a deck, and then encapsulates the information and card within the deck.

3. File header (head Element)
Header information contains information about deck, including meta data and control elements.

3.1, Access rights settings (Access)

This element is used to set a list that has access to the current deck permission. If the access element information is not included in the deck, the access element under the deck is in an invalid state, and all other deck can access the deck.

Related properties:

Domain: If you set <access domain= "sina.com.cn"/> Then http://www.sina.com.cn/ will have access rights, and http:// www.sino.com.cn/ and http://www.sina.net.cn/ are not.

Path: Works very similar to domain, such as setting <access path= "/internal"/> Then "/INTERNAL/WML" will gain access, and "/INTERNAL-WML" is not.

Example:

Make the following settings <access domain= "sina.com.cn" path= "/wap"/>

Then several URLs have access rights:

  http://www.sina.com.cn/wap/goto.cgi
  HTTP://WWW.SINA.COM.CN/WAP/INDEX.WML
  http://www.sina.com.cn/wap/cgi-bin/create_report.cgi?name=123&pwd=234

Some of the following URLs do not have access rights:

  http://www.sina.com/wap/getuid.cgi
  http://www.sina.com.cn/internal/wap/getuid.cgi

3.2. Header element Settings (Meta)

The <meta property content= "value" scheme= "format" forua= "True|false"/> and similar in HTML, provides meta information for the deck.

For example: <meta http-equiv= "Cache-control" content= "max-age=0" forua= "true"/>

The content attribute is 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.

Currently supported Meta data:

<meta http-equiv= "Cache-control" content= "max-age=0"/> Specifies the storage time period for deck in the phone's memory cache, which defaults to 30 days (unless memory runs out), The mobile phone is invoked directly from the cache for the deck accessed. If the information is time-sensitive, you can use Max-age to specify the lifetime of the deck in the cache, the smallest unit is seconds, and if you specify 0, each time you need to call the deck by connecting to the server.

<meta user-agent= "Vnd.up.markable" content= "false"/> and <meta user-agent= "Vnd.up.bookmark" content= "specified URL"/ > Bookmark features similar to normal browsers. When a user bookmarks a card, the mobile browser first records the card with a tag, which defaults to the title attribute in the <card> tag (which is discussed later), and then opens the URL that is logged when the user chooses the bookmark. But because in the default case, the hand opportunity records all the deck, therefore, the general <meta> is used to make the handset not to record the current URL, namely <meta user-agent= "Vnd.up.markable" content= false "/>. In addition, if you want to specify a URL that is different from the current dreck for the bookmark, use the <meta user-agent= "Vnd.up.bookmark" content= "specified URL".

4, Template (Template)
In order to save resources, you can set every card in the task to be used in the template, for the current deck all card use, add individual card does not need the template content, you can override it (see Task Shield).

5, cards (card)
Applicable events

The following events apply to card and template, as described earlier.
1. Onenterbackward
2. Onenterforward
3. OnTimer

Card Properties (cards)

ID: The unique identification of the card within the same deck, which can be used as a label. (#nextcard).

Title: Card titles. Different browsers deal with the title of the principle is not the same, some browsers will display the title, if the current card does not set the title, the current card URL will be displayed in the title position. Some browsers ignore headings to save the display area.

Newcontext: The default value is false to indicate that when jumping to this card, the phone is not to clear the previously retained information, including variables, the history of the stack, reset mobile phone status.

Ordered Boolean variable to declare whether the card is in order. Can often be used to develop an autoplay slide effect.

Example:

<?xml version= "1.0"?>
<! DOCTYPE WML public "-//wapforum//dtd WML 1.1//en" "http://www.wapforum.org/DTD/wml_1.1.xml" >
<wml>

<access domain= "sina.com.cn" path= "/wap"/>

<template>
<do type= "Accept" name= "accept1" label= "OK" >
<go href= "#accept"/>
</do>
</template>

<card id= "Start" title= "Start Here" >
<p> Start here. </p>
</card>

<card id= "Accept" title= "Okay card" >
<do type= "Accept" name= "accept1" label= "Okay" >
<go href= "#accept2"/>
<!--override the same task in template-->
</do>
<p> Card Accept </p>
</card>

<card id= "Accept2" title= "OK Card" >
<do type= "Accept" >
<go href= "#start"/>
</do>
<p> Card Accept2 </p>
</card>

</wml>



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.