WML Features Lost
in XHTML MP
Some
of the features available in WML 1.x do not exist in XHTML MP any
more. In this section, you will learn about these differences between
WML 1.x and XHTML MP. This section is particularly useful for those
who are familiar with WML 1.x but are new to XHTML MP, or those who
want to migrate their mobile Internet application from WML 1.x to
XHTML MP.
For
some of the WML features lost, there are ways to achieve similar
effect in XHTML MP. It should be noted that WAP 2.0 is backward
compatible to WML 1.x, which means WAP 2.0 mobile devices can display
WML 1.x documents. If there is a WML feature that you must use but is
not available in XHTML MP, you can consider developing your WAP
application with WML 1.x.
Here
are the major WML features lost in XHTML MP:
XHTML
MP does not support decks and cards
XHTML
MP does not support timers
XHTML
MP does not support events
XHTML
MP does not support variables
XHTML
MP does not support client-side scripting
XHTML
MP does not support programmable softkeys
XHTML
MP does not support the <u> tag
XHTML
MP does not support the format attribute for input fields
XHTML
MP does not support posting of data with anchor links
XHTML MP Does Not
Support Decks and Cards
The
<deck> and <card> elements of WML do not exist in XHTML
MP any more. In WML, a file can contain one or more cards. Together
they form a deck. All cards in a deck are downloaded to the wireless
device at a time. The WAP browser displays one card each time and you
can go to other cards through anchor links. With the use of decks and
cards, the number of round-trips to the server is reduced. The
performance increase can be significant, since the latency of each
request to the server is high for wireless devices.
To
achieve similar feature in XHTML MP, you can use multipart messages
(multiple documents are put in a single HTTP response). Another way
is to make use of target anchors (target anchors are placed at
various locations in a page, and links are defined for users to
scroll to the target anchors. More details will be mentioned later at
"Going to a Location in the
Current XHTML MP Page").
XHTML MP Does Not
Support Timers
To
create a timer in WML, you use the <timer> tag and the ontimer
event. Both the <timer> tag and the ontimer event are not
supported in XHTML MP.
To
achieve similar functionality in XHTML MP, try HTTP refresh, like
this:
... <head> ... <meta
http-equiv="refresh"
content="10;URL=http://www.developershome.com/"
/> ... </head> ...
In
the above XHTML MP example, the <meta> element tells the WAP
browser to go to the URL "http://www.developershome.com/"
after 10 seconds. Note that a WML timer will start only if the user
goes to the card in the forward direction, while a HTTP refresh timer
starts whenever the user goes to the XHTML MP page.
More
details about HTTP refresh will be mentioned later at "Periodic
Refresh in XHTML MP".
XHTML MP Does Not
Support Events
Events
are not available in XHTML MP. WML supports four events: ontimer,
onenterbackward, onenterforward and onpick. As discussed in the
previous section, HTTP refresh can simulate the ontimer event. For
the other events, there is no alternative in XHTML MP. If the use of
them is a must for your mobile Internet browsing application, you
have to consider using WML 1.x instead of XHTML MP.
XHTML MP Does Not
Support Variables
In
WML, you can declare variables and assign a value to it. WML
variables have global scope, which means you can use them in any
decks and cards. One common use of variables in WML is to store the
data typed by a user so that he/she needs not to type the data again
later.
You
cannot make use of variables in XHTML MP. The alternative is to put
all processing at the server-side. For example, if you want to share
the data typed by a user on one XHTML MP page with other XHTML MP
pages, the data should be sent to and stored at the server. Later the
server can embed the user data in the XHTML MP markup when necessary
and send it to the wireless device.
XHTML MP Does Not
Support Client-side Scripting
In
WML, you can use a client-side scripting language called WMLScript,
which is similar to JavaScript. One common use of WMLScript in WML is
to validate data entered by users.
Client-side
scripting is not currently available for XHTML MP. The alternative is
to put all processing at the server-side. For example, instead of
validating user data locally at the wireless device, the user data
can be posted to the server for processing. If the user data is of
the wrong format, outside the valid range, or is missed in some
fields, the server can direct the user to an XHTML MP page to correct
the data.
Future mobile devices will support a
client-side scripting language called ECMAScript Mobile Profile (ESMP),
which is designed to be used with XHTML MP. It supports all WMLScript functionality.
|
Feedback Form (ExpandCollapse)
|
|