The features available in some WML 1.x are no longer present in the XHTML MP. In this section, you will learn these differences between the WML 1.x and the XHTML MP. This section is especially useful for those who are familiar with WML but are new to the XHTML MP, or who want to migrate their mobile internet applications from WML 1.x to XHTML MP.
Although some of the features of WML are lost, there are ways to achieve similar effects in the XHTML MP. It should be noted that WAP 2.0 is back-compatible for WML 1.x, which means that the WAP 2.0 mobile device can display WML 1.x documents. If you have to use a feature that is valid in WML but not valid in the XHTML MP, then you can consider developing your WAP application with WML 1.x.
These are the characteristics of the main WML language lost by the XHTML MP:
XHTML MP does not support Deck and card
The XHTML MP does not support timers
XHTML MP does not support events
The XHTML MP does not support variables
XHTML MP does not support client script
XHTML MP does not support soft key (accesskey) programming
XHTML MP does not support <u> tags
The input field for the XHTML MP does not support formatting properties
XHTML MP does not support sending data by anchor
XHTML MP does not support Deck and card
The <deck> and <card> elements in WML are no longer present in the XHTML MP. In WML, a file can contain one or more card cards. Together, they formed a deck. All the card in a deck will be downloaded to the wireless device one at a time. The WAP browser displays a card at a time, and you can pick up other cards through the anchor. By using deck and card, the interaction with the server is reduced. This can result in significant performance improvements because, for wireless devices, the latency of requests to the server is high.
To achieve similar functionality in the XHTML MP, you can split the message into multiple sections (multiple documents in one HTTP feed). Another way is by taking advantage of the target anchor, where the target anchors are placed on the page, and the link is defined to flow to the corresponding target anchor. More details will be mentioned later in "somewhere on the current XHTML MP page".
The XHTML MP does not support timers
To use timers in WML, you can use <timer> tags and ontimer events. <timer> tags and ontimer events are not supported in the XHTML MP.
To implement similar functionality in the XHTML MP, try HTTP refreshes like this:
In the above XHTML MP example, the <meta> element tells the WAP browser to go to the URL "http://www.phparch.cn" 10 seconds later. Note that the WML timer is only turned on when the user advances to the card, and the HTTP refresh timer will open whenever the user arrives at the XHTML MP page.
More details about HTTP refreshes will be mentioned in a later "intermittent refresh in the XHTML MP".
XHTML MP does not support event XHTML MP does not support events. WML supports four kinds of events: OnTimer, Onenterbackward, Onenterforward and Onpick. As discussed in the previous section, HTTP refreshes can simulate OnTimer events. For other event types, there are no alternatives in the XHTML MP. If your mobile Internet browsing applications must use them, then you have to consider using WML 1.x instead of the XHTML MP.
The XHTML MP does not support variables
In WML, you can declare a variable and assign a value to it. A WML variable has a global scope, which means you can use them in any deck and card tags. The use of variables that are common in WML is used to store data entered by the user so that they are not entered again later.
You cannot use variables in the XHTML MP. The alternative is to put all the processing on the server side. For example, if you want to share data that users have entered on an XHTML MP page to other XHTML MP pages, send the data to and store it on the server. The server can then embed user data into the XHTML MP tag when necessary and send it to the wireless device.
XHTML MP does not support client script
In WML, you can use a scripting language called WMLScript, which is similar to JavaScript. A common application of wmlscript in WML is to validate the data entered by the user.
For the XHTML MP, client script is currently invalid. The alternative is to put all the processing on the server side. For example, you can send user data to server-side processing rather than validating user data on a wireless device. If the user data is formatted incorrectly, is out of range, or the user forgets to enter some fields, the server directs the user to an XHTML MP page to correct the data.
Future mobile devices will support a client-side scripting language called the ECMAScript Mobile Profile (ESMP), which is designed for use in the XHTML MP. It supports all WMLScript features.
XHTML MP does not support soft key (softkey) programming
Programmable software is a very good feature of WML. The WML <do> tag can be used to program soft keys. Users can easily select common options by pressing the left or right soft keys on their mobile phones.
You cannot program soft keys in the XHTML MP. An alternative scenario is to take advantage of the accesskey attribute. The AccessKey property can be used to specify keyboard shortcuts. The chain connection and submit button support the AccessKey property. This is an example:
<a accesskey= "1" href= "/p1.xhtml" >xhtml MP Tutorial First part </a><br/><a accesskey= "2" href= "/p2.xhtml" > XHTML MP Tutorial Part II </a><br/><a accesskey= "3" href= "/p3.xhtml" >xhtml MP Tutorial Part III </a>
If the user presses the "1" key on the keyboard, the WAP browser will jump directly to "p1.xhtml". With the accesskey attribute, a user can trigger an action by clicking on the XHTML MP page. This behavior is similar to what can be achieved through soft keys.
The-wap-accesskey property of a WAP CSS can be used as an alternative to accesskey properties.
On some Nokia WAP browsers, all anchor and submit buttons with the keyboard shortcuts specified with the accesskey attribute are automatically included in the Options menu. Users can open the Options menu by clicking on the soft keys on the left. The tag in the Options menu is the text enclosed by the <a></a> label. For the picture link and submit button, the labels in the menu options are the Alt attribute value of the label and the value of the <input> tag. For example:
<a accesskey= "0" href= "/p1.xhtml" >xhtml MP Tutorial First part </a><br/><a accesskey= "1" href= "/p2.xhtml" > </a><br/><form action=" Xhtml_ mp_tut.php "method=" ><p> what is your favorite part of this HTML MP tutorial? <br/><input type= "text" name= "Tut_part" title= "edit "/><br/><input accesskey=" 5 "type=" Submit "value=" Submission Form "/></p></form>
In the example of the XHTML MP above, bold text becomes a label in the Options menu. If too long the label will be truncated.
Note that the feature is not valid on a non-Nokia browser.
XHTML MP does not support <u> tags
In WML, the label <u> can be used to underline some text.
Label <u> does not exist in the XHTML MP. To underline text in the XHTML MP, you have to use the Text-decoration attribute of the WAP CSS. For example, to underline all the text in Heading 1, you can add the following style expression to your XHTML MP page's WAP CSS style sheet:
h1 {Text-decoration:underline}
The input field for the XHTML MP does not support formatting properties
In WML, you can limit the type and number of characters that a user can enter in an input field by specifying a value for the format attribute of the <input> element.
In the XHTML MP, the format attribute of the <input> element has been deleted. The alternative is to take advantage of the-wap-input-format properties of WAP CSS. The-wap-input-format property uses an input mask that has the same syntax as the formatting property. For example, to limit all input fields to only five digits, you can enter the following style representation in the WAP CSS of your XHTML MP page:
Input {-wap-input-format: "5N"}
You can find more information about the-wap-input-format attribute from the Internet.
XHTML MP does not support sending data by anchor
In WML, the submission of user data to the server is achieved through a chain connection, like this:
<p> What's your name? <input name= "name"/><br/> What part of this HTML MP tutorial do you like best? <input name= "Tut_part"/><br/ ><anchor><go method= "Get" href= "/xhtml_mp_tut.php" ><postfield name= "name" value= "$ (name)"/> <postfield name= "Tut_part" value= "$ (tut_part)"/></go> Send data </anchor></p>
The XHTML MP does not support sending data through anchor cables. Must be implemented with the Submit button. The following XHTML MP tag is the same thing as the preceding WML tag. Further details about submitting data to the server will be described in this tutorial, "submitting form data to the server in the XHTML MP."
<form action= "xhtml_mp_tut.php" method= "get" ><p> what's your name? <br/><input name= "name"/><br/ > Which part of this HTML MP tutorial do you like best? <br/><input name= "Parts"/><br/><input type= "Submit" value= "Submitting data"/>& Lt;/p></form>
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.