Embedded Systems October 2000 Vol13_11

Issue link:

Contents of this Issue


Page 53 of 181

like any language, WMl has syntax rules and requires a parser to determine if a submitted program is correct. ~~wo card example navigating with

Working with WAP

Working with More WAP

1 This rather cryptic statement says the WML document is based on XML ver- sion 1.0, and t11e version ofWML used is 1.1 and can be found at the URL indicated. ACCEPT action type accepts the user press of the soft key and takes the action specified within the and . A common construct with tags is the element. The element attempts to navigate to another card or another deck. If the element specifies another card, that card is dis- played. If a deck is specified, the deck is retrieved and the first card is dis- played. A WML listing that includes two cards and a statement is shown in Listing 1. Two soft keys are assigned in this example, one labeled "Next" in Cardl and one labeled "Last" in Card2. Cardl contains a small text block, "Working with WAP," that is displayed first. If a user accesses the "Next" soft key, Card2 is retrieved and the text "Working with More WAP" is dis- played. Both cards are cached on the client device, and the client user agent positions the text independent- ly of the WML program since no for- matting information is included. Different user agents display this sim- ple program differently, depending on the client's display capability. A Nokia phone will display the program slightly differently than a Motorola phone. How does the user agent know that Cardl and Card2 are already on the client device? First, no URL is speci- fied. Second, a hash mark, II, precedes the card name. The hash mark says the card is local. Think of it as a "load immediate" type of instruction. As a WML author, how do you know if your program is correct? Like any language, WML has syntax rules and requires a parser to determine if a submitted program is correct. WML, being based on XML, has a well speci- fied document type. A document type declaration must appear at the begin- ning of every WML document. The type declaration is: 52 OCTOBER 2000 Embedded Systems Programming WML navigation and events Navigation in WML is tied closely to events and tasks. Events are usually bound to tasks and result in navigating to a new URL. Events can be intrinsic or explicit. Intrinsic events enable WML elements to generate events when interacting with a user. If a par- ticular type of action occurs, the event is generated. Intrinsic events are rec- ognized by four WML elements: on timer, onenterforward, onenterbackward, and onpick. These are types associated with an oneuent element. For example, an onenterforward event is generated when a new card is entered. Explicit events are generated by constructs such as statements, as explained previously. Tasks WML supports four major "inter-card traversal" mechanisms, or tasks. The tasks are go, preu, noop, and refresh. The go task can take up to 10 steps and finally resolves to navigating to a URL. The prev task can take up to seven steps and results in popping a URL off the history stack and locating a card assigned to the URL. The noop task does no processing. The refresh oper- ation redisplays the curren t card. This operation is used if any variable's state changes affect the display

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems October 2000 Vol13_11