This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA
The first WML example
Text containing information .
Select Next to display the next card. This card contains the following:... Card 1 ... Card 3 ... Card 1 ... Card 2 ... Card 3 ... Card 1 Contents... Card 2 Contents... Enter your name: Hello $(username)! First name: Amount: <select name="from" value="USD" title="From:"> <select name="to" value="FIM" title="To:"> Please choose your favorite animal: <select iname="I" ivalue="1"> Please choose all of your favorite animals: <select name="X" iname="I" ivalue="1;2" multiple="true"> Normal text and a This is normat text, but here is a Hello World! Hello <em> A Demonstration of Nokia’s <strong> Wireless Application Protocol
Specifies a paragraph.
Specifies italic text emphasis.
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
The following table lists other attributes of the card element. For more detailed information on the attributes of the card element and how to use it, refer to the WML Reference included in the Nokia WAP Toolkit. Attributes
Explanation
newcontext="false"
If you set this attribute to true, the browser context is re-initialized upon entry to this card. The browser context is used to manage all parameters and user agent states, including variables, the navigation history and other implementation-dependent information related to the current state of the user agent.
ordered=boolean
Gives an indication to the user agent about how the card content is organized.
onenterforward="href"
Navigates to the location specified by href. Occurs when the user navigates into a card using a go task.
onenterbackward="href"
Navigates to the location specified by href. Occurs when the user navigates into a card using a prev task.
ontimer="href"
Navigates to the location specified by href after a specified amount of time.
xml:lang
Specifies the natural or formal language in which the document is written.
id
Provides an element with a unique name within a single deck.
class
Affiliates an element with one or more classes.
!
Note: The Nokia WAP Toolkit 1.2 software does not support the ordered="boolean" attribute.
NOKIA WAP TOOLKIT
15
Developer’s Guide
Working with WML elements
Events You use the events elements to handle navigation and functions. The following table briefly explains when you use these elements. Element
Explanation
do
Provides a general mechanism for performing actions on the current card.
ontimer
Specifies an intrinsic event that occurs when a timer expires.
onenterforward
Specifies an intrinsic event that occurs when the user enters a card under specific circumstances.
onenterbackward
Specifies an intrinsic event that occurs when the user navigates into a card by using an URI retrieved from the history stack (see “History stack” on page 26).
onpick
Specifies an intrinsic event that occurs when the user selects or deselects an item in which the event is specified.
onevent
Binds a task to a particular intrinsic event.
postfield
Specifies a field name and value for transmission to an origin server during an URI request.
do element A card element can contain do elements that assign a task to a certain key. For a description of the available task elements, see “Task elements” on page 17. The following is a simple example of how to use the do element: <do type="tasktype" label="label" name="name" optional="false">
16
Component
Explanation
<do>
The start tag of the do element. Do elements may appear inside a card and template. Note that you may specify only one task for one do element.
type="tasktype"
Specifies the type of task to execute. For example, accept navigates to the next card, and prev
NOKIA WAP TOOLKIT
Working with WML elements
Component
Developer’s Guide
Explanation
returns to the previous card. For a complete list of the available types, refer to the WML Reference. The type attribute is required. label="label"
Specifies the label for the soft key.
name="name"
Specifies the name of the do task binding.
optional="false"
If you set this attribute to true, the user agent may ignore this element.
See also “Example deck” on page 21. For more detailed information on the attributes of the do element and how to use it, refer to the WML Reference.
Task elements A do element can contain tasks that specify what the user agent is to do when the user activates a task by pressing a key or navigating to a card or deck, for example. The go, prev, noop and refresh tasks of WML are described in the following table. For more information on WML tasks and how to use them, refer to the WML Reference. Task
Explanation
go
Indicates navigation to a location specified by href. If the href names a WML card or deck, it is displayed.
prev
Indicates navigation to the previous URI in the history stack (see “History stack” on page 26).
refresh
Indicates an update of the user agent context as specified by the setvar tags (see “Variables ” on page 19).
noop
Indicates that nothing should be done.
NOKIA WAP TOOLKIT
17
Developer’s Guide
Working with WML elements
go task The go task indicates navigation to location specified by an href. If the href names a WML card or deck, it is displayed. The following is a simple example of how to use the go element.
Component
Explanation
Start tag of a go element, indicating navigation to a href.
href="href"
Specifies the destination, for example, the location of the card to display. This attribute is required.
The following table lists other attributes of the go element. For more detailed information on the attributes of the go task and how to use it, refer to the WML Reference.
18
Attribute
Explanation
sendreferer=boolean
If you set this attribute to true, the user agent includes the deck URL in the HTTP request.
method="post|get"
Specifies the HTTP submission method. Currently, the values of get and post are accepted and cause the user agent to perform an HTTP get or post respectively.
accept-charset="chset"
Specifies the list of character encodings for data that the web server must accept when processing input. The default value is unknown. The user agent uses the character encoding that was used to transmit the WML deck containing this attribute.
id
Provides an element with a unique name within a single deck.
class
Affiliates an element with one or more classes.
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
prev task The prev element declares a prev task, indicating navigation to the previous URI on the history stack. A prev performs a pop operation on the history stack (see “History stack” on page 26). The following table lists attributes of the prev element. For more detailed information on the attributes of the prev task and how to use it, refer to the WML Reference. Attribute
Explanation
id
Provides an element with a unique name within a single deck.
class
Affiliates an element with one or more classes.
refresh task The refresh element declares a refresh task, indicating an update of the user agent context as specified by the setvar element (see “Setting variables” on page 28). Side effects of the state changes that are visible to the user (for example, a change in the screen display) occur during the processing of the refresh task. For more detailed information on the the refresh task and how to use it, refer to the WML Reference.
noop task The noop element specifies that nothing should be done, that is, “no operation”. You will find this a useful element when you want to override template action (see “Using the template element” on page 24). For more detailed information on the noop task and how to use it, refer to the WML Reference.
Variables Parameters can be set for all WML content, giving you a great deal of flexibility in creating cards dynamically change display content and navigation based on user input. WML variables can be used instead of strings; their current value is substituted at runtime. You use the setvar element to specify a variable. See “Variables and dynamic interfaces” on page 27.
NOKIA WAP TOOLKIT
19
Developer’s Guide
Working with WML elements
User input You use the user input elements to handle user input in WML. The following table briefly explains when you use these elements. See “User input” on page 31 for more information. Element
Use
input
Specifies a text entry obect.
select
Allows the user to choose from a list of options. WML supports both singlechoice and multiple-choice lists.
option
Specifies a single choice option in a select element.
optgroup
Lets you group related option elements in a hierarchy to facilitate layout and presentation by the user agent.
fieldset
Lets you group related fields and text.
Anchors, images, and timers The following table briefly explains when you use the elements in this category.
20
Element
Use
anchor
Specifies the beginning of a connection between one document and another, or between one part of a document and another part of the same document. See “Using links” on page 39.
a
Provides a short form of the anchor element. See “Using links” on page 39.
img
Places images into the text flow.
timer
Implements a card time that can be used to process inactivity or idle time. See “Using timer” on page 40.
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
Text formatting You use the text formatting elements to format any text in the card. The following table briefly explains when you use these elements. See “Displaying text” on page 43 for more information. Element
Use
br
Establishes the beginning of a new line.
p
Establishes both the line wrap and alignment parameters for a paragraph.
table
Creates sets of aligned columns of text and images in a card.
tr
Used with the table element, indicates a container to hold a single table row.
td
Used with the table element, indicates a container to hold a single table cell data within a table row.
In addition, you can use the emphasis tags to specify text emphasis markup information, as explained in “Emphasis” on page 43.
Example deck The following WML illustrates a deck containing two cards. When the user presses the ACCEPT soft key labeled “Next,” the user agent navigates to the second card of the deck and displays its content. Note that the line numbers are used for reference purposes only and are not part of the actual code. <wml>
NOKIA WAP TOOLKIT
1 --> 2 --> 3 --> 4 --> 5 --> 6 --> 7 --> 8 --> 9 --> 10 --> 11 --> 12 -->
21
Developer’s Guide
Working with WML elements
13 14 15 16 17 18
--> --> --> --> --> -->
In the user agent, the above WML generates the following interface:
A deck containing two cards.
The following is a line-by-line explanation of this example: 1
The first three lines identify the XML subset. This identification must be included at the beginning of every WML deck, that is, before every <wml> tag.
4
The fourth line is the top-most element of the WML deck. All WML decks must begin with a <wml> tag and end with a tag.
5
The fifth line of the deck is the top-most element of the first card. Like decks, cards require begin and end tags, for example,
22
6
The sixth line defines an action, which specifies what the user agent should do when the user presses a specified function key. The type attribute identifies the key (accept) and the label attribute a label name (Next) for the specified key.
7
The seventh line specifies the action related to the specified key. The href attribute identifies the target href destination, for example, the card named card2.
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
Multiple cards in multiple decks You are not required to put all the cards used by one of your services in a single deck. It is recommended that you limit the size your decks, since different user agents have different memory restrictions. Contact your vendor to find out what the limitations of your user agent are, and take them into consideration when creating your own WML decks. For example, the deck2a.wml and deck2b.wml files provided with the Nokia WAP Toolkit demonstrate dividing content onto multiple decks and cards. Deck2a.wml contains a template that defines a backward navigating task. In card1
the template task is overridden with a no-operation task. The third card includes a go task that specifies the URL of the deck2b.wml. When the user activates the go task, the user agent navigates to the deck and displays its content. Note that this example uses the template element. See “Using the template element” on page 24 for more information about this element. <wml> <do type="prev" name="Previous" label="Previous"> <prev/>
<do type="accept" label="Next Card">
NOKIA WAP TOOLKIT
23
Developer’s Guide
Working with WML elements Card 2 ...
<do type="accept" label="Next Card">
<do type="accept" label="Next Deck">
Using the template element You can define do elements at several levels in WML. The examples in the previous sections define them at the card level. However, you can also define them at the deck level by using the template element. A do element’s scope covers the wml element in which it is defined. If you define it in a deck’s template, it applies to the whole deck—if you define it in a card, it applies only to that individual card. Note that when a do element appears inside another element, the element with the narrower scope takes precedence. You can include the following elements in a template: n
do
n
onevent
n
onenterforward
n
onenterbackward
n
ontimer
In the following example, a deck-level do element indicates that a prev task should execute on receipt of a particular user action. n
24
The first card inherits the do element specified in the template and will display the do to the user.
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
n
The second card overrides the deck-level do element with a noop. The user agent will not display the do element when displaying the second card.
n
The third card does not override the deck-level do element because it uses a different name attribute.
<wml> <do type="options" name="Prev" label="Previous"> <prev/>
NOKIA WAP TOOLKIT
25
Developer’s Guide
Working with WML elements
History stack You can view the history stack of the Nokia WAP Toolkit by clicking the History tab at the bottom of the simulator application window. The following figure shows an example of a history stack.
Example of a history stack.
Note the following:
26
n
The last card visited appears at the top of the stack. When you navigate to a new card, the URL of that card appears at the top of the stack.
n
This view shows the history stack of the current browser context only. Each time the browser context is re-initialized, the history stack is cleared.
n
The size limit indicates the history stack size. This is a preference and you can change this size under the General tab of the Preference window (see Getting Started for more information on Preferences).
n
You can clear the history stack manually by clicking Clear.
n
You can navigate to the selected card by clicking Go.
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
Variables and dynamic interfaces This section discusses how you can set variables explicitly and substitute variables into WML.
Naming variables WML variable names consist of an US-ASCII letter or underscore followed by a zero or more letters, digits or underscores. Any other characters are illegal. Note also that variable names are case-sensitive. Parentheses are required anywhere the end of a variable cannot be inferred from the surrounding context, for example, if the variable ends with an illegal character such as a white space. The following examples demonstrate legal variables: This is a $var This is another $(var). This is an escaped $(var:e). Long form of escaped $(var:escape). Long form of unescape $(var:unesc). Short form of no-escape $(var:N). Other legal variable forms: $_X $X32 $Test_9A
A side effect of the parsing rules is that the literal dollar sign must be encoded with a pair of dollar sign entities. A single dollar sign entity, even when specified as $, results in a variable substitution. In order to include a $ character in a WML deck, it must be explicitly escaped by using the following syntax: $$
Two dollar signs in a row are replaced by a single $ character. For example: This is a $$ character.
would be displayed as: This is a $ character.
To include the $ character in URL-escaped strings, specify it with the URL-escaped form %24.
!
NOKIA WAP TOOLKIT
Note: Variable names are case sensitive. This means that variable1, Variable1 and varIABle1 are all different variables.
27
Developer’s Guide
Working with WML elements
Setting variables There are a number of ways to set the value of a variable. When a variable is set and already defined in the browser context, the current value is updated. The setvar element allows you to set the variable state as a side effect of navigation. VAR may be specified in the following task elements: n
go
n
prev
n
refresh
Variables can also be set in the following situations: n
Input elements set the variable identified by the name attribute to any information entered by the user. — The input element assigns the entered text to the variable. — The select element assigns the value present in the value attribute of the chosen option element.
Note that the user input is written to variables when the user commits the input to the input or select element. The VAR element specifies a variable name and value, for example: <setvar name="location" value="$(X)"/>
The variable name specified in the name attribute (for example, location) is set as a side effect of navigation. Note the following when setting variables:
28
n
You can change variable values set with WML using WMLScript and vice versa, meaning that WML and WMLScript use the same variables.
n
You can set and edit variables in the Nokia WAP Toolkit Variables view.
n
You can use the newcontext attribute to clear all the variable values of the current browser context.
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
Substituting variables Variable values can be substituted into formatted text, option values and URL attributes in WML elements. However, note that only textual information can be substituted, that is, no substitution of elements or attributes is possible. The substitution of variable values happens at runtime in the user agent. As the substitution is merely a string substitution operation, it does not affect the current value of the variable. If an undefined variable is referenced, it results in the substitution of the empty string. The following table describes how you can substitute variable values. Variable reference
Explanation
$var or $(var)
Value of var is substituted using the conversion format appropriate for the context.
$(var:e) or $(var:escape)
Value of var is substituted using URL-escaping.
$(var:unesc)
Value of var is substituted using URL-unescaping.
$(var:N) or $(var:noesc)
Value of var is substituted without changing the value of the variable.
Note that the use of a conversion during variable substitution does not affect the actual value of the variable. If no conversion is specified, the variable is substituted using the conversion format appropriate for the context. The onenterbackward, onenterforward, href and src attributes default to escape conversion; elsewhere, no conversion is done. Specifying the noesc conversion disables context-sensitive escaping of a variable. For more detailed information on the variable substitution syntax, refer to the WML Specification.
Variable example The following example demonstrates the use of tasks and variables in WML decks and cards. Note that the variables will not be set until the user navigates to the second card of the deck. <wml>
card1 var1 = $(card1_var1)
card2 var1 = $(card2_var1)
NOKIA WAP TOOLKIT
29
Developer’s Guide
Working with WML elements <do type="accept" label="Next">
card1 var1 = $(card1_var1)
card2 var1 = $(card2_var1)
<do type="prev" label="Previous"> <prev/>
When you navigate to the first card of the deck, the following user interface is displayed:
Variables with no values.
n
Note that the variables have not yet been set.
n
When you press Options to navigate to the second card, the variable card1_var1 is set.
n
Upon entry to the second card, the variable card2_var1 is set and the browser context is refreshed. Now the user agent displays the following user interface:
Variables with values.
30
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
User input WML includes two interactive card elements: input and select. The following sections describe how you can use them to prompt the user for input and how to handle the input. For more information on text input and select lists, refer to the WML Reference.
input element The input element specifies a text entry object. You can determine the format of the string the user enters and place default text in the entry field. The following is a simple example of how to use the input element:
Component
Explanation
The start tag of the input element.
Entry
The prompt text the card displays to the user.
name="varname"
Specifies the name of the variable to set with the result of the user’s text input. This attribute is required.
default="default"
Specifies the default that appears in the entry field.
format="fmt"
Specifies an input mask for user input entries. The default format allows the user to enter any character. For detailed information on the available format control characters, see “Specifying the character format” on page 34.
emptyok="boolean"
If you set emptyok to true, the input element accepts empty input although a format string that is not empty has been specified. The default is false.
size="input_size"
Specifies the width, in characters, of the text input area.
maxlength="max_char"
Specifies the maximum number of characters that the user can enter in the text entry area. The default is unlimited.
tabindex="number"
Specifies the tabbing position of the input field. The tabbing position indicates the relative order in which elements are traversed when tabbing within a single WML card.
NOKIA WAP TOOLKIT
31
Developer’s Guide
Working with WML elements
The following table lists other attributes of the input element. For more detailed information on the attributes of the input element and how to use it, refer to the WML Reference. Attribute
Explanation
value="value"
Specifies the value of the variable named in the name attribute. The default and value attributes are identical in their behavior and syntax.
type="input_type"
Specifies the type of the text input area. The allowed values are text and password. In text type, input is displayed to the user in a readable form. In password type, input of each character is echoed in an obscured form. Note that password input is insecure and critical application should not be dependent on it. The default type is text.
title="title"
Specifies a title for the input element. The title may be used in the presentation of this object.
xml:lang
Specifies the natural or formal language in which the document is written.
id
Provides an element with a unique name within a single deck.
class
Affiliates an element with one or more classes.
The following deck defines a card requesting the user to enter a name and a card displaying the name entered. <wml>
32
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
This deck generates the following interface in the user agent (as shown on a 6150 model phone):
Text entry card.
The deck operates as follows: 1
When you navigate to the card, the prompt asks you to enter your name. Press Options to see the selections. Press Select to go to input card.
2
In the input card that appears, enter your name by using your computer keyboard or the keypads of the simulator phone. When you are done, press OK.
3
The first card appears again, with the name you entered. Press OK to go to the second card of the deck.
The name attribute specifies a variable name to which the phone stores the text that the user enters in the text entry field. To substitute a variable value at runtime, you must add a dollar sign ($) in front of the variable name.
NOKIA WAP TOOLKIT
33
Developer’s Guide
Working with WML elements
Specifying the character format With the format attribute you can specify the character format in which the user can enter text input. The following special characters are available:
34
Character
Explanation
A
Allows any upper-case alphabetic or punctuation character, that is, upper-case non-numeric character.
a
Allows any lower-case alphabetic or punctuation character, that is, lower-case non-numeric character.
N
Allows any numeric character.
X
Allows any upper-case character.
x
Allows any lower-case character.
M
Allows any character. The user agent may choose to assume that the character is upper-case for the purposes of simple data entry, but must allow entry of any character. This is the default format.
m
Allows any character. The user agent may choose to assume that the character is lower-case for the purposes of simple data entry, but must allow entry of any character.
*f
Allows any number of characters; f is one of the above format codes and specifies what kind of characters can be entered. Note that this format can only be specified once and must appear at the end of the format string.
nf
Allows n characters where n is a number from 1 to 9; f is one of the above format codes and specifies what kind of characters can be entered. Note that this format can only be specified once and must appear at the end of the format string.
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
Character
Explanation
\c
Displays the next character, c, in the entry field. Allows quoting of the format codes so they can be displayed in the entry area. For example, let us suppose that you use the format specifier \(3N\). This instructs the user agent to automatically insert a left parenthesis before the user has entered anything, and a right parenthesis after the user has entered three digits.
The following example is a card that prompts the user for a first name, last name and age. Note that in the Age field the user can enter a two-digit number.
Last name:
Age:
select element A select list specifies a list of options that the user can choose from. WML supports both single-choice and multiple-choice lists. The following is a simple example of how to use the select element:
= $(conversion) <do type="accept" label="Calculate">
NOKIA WAP TOOLKIT
35
Developer’s Guide
Working with WML elements <do type="help" label="Help">
Component
Explanation
<select>
Start tag of the select element.
multiple="boolean"
If you set this attribute to true, the select list accepts multiple selections. When the attribute is not set, the select list accepts only a single selected option. The default value is false.
name="varname"
The name of the variable that receives the value of the chosen item.
default="default"
The default value of the variable specified by the name attribute. If the name variable already contains a value, the name attribute is ignored.
title="title"
A title for the select element, which can be used in the presentation of this object.
The following table lists other attributes of the select element. For more detailed information on the attributes of the select element and how to use it, refer to the WML Reference.
36
Attribute
Explanation
iname="varname"
The name of the variable that is set with the index result of the user selection. When the user selects an item, the user agent sets the variable specified by iname to the number of the chosen item. The number 1 specifies the first item, the number 2 the second item, and so on. The number 0 indicates that no option is selected.
ivalue="default"
The index of the option element selected by default. If the variable specified by the iname attribute is not set when the card is displayed, it is assigned the entry selected by default. If the variable already contains a value, the ivalue attribute is ignored.
tabindex="number"
Specifies the tabbing position of the input field. The tabbing position indicates the relative order in which elements are traversed when tabbing within a single WML card.
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
Attribute
Explanation
xml:lang
Specifies the natural or formal language in which the document is written.
id
Provides an element with a unique name within a single deck.
class
Affiliates an element with one or more classes.
Single-choice list The following example illustrates a simple single-choice list with a default value. Note the following: n
The “dog” option would be pre-selected if the “I” variable had not been previously set.
n
If the user were to choose the “cat” option, the variable “I” would be set to a value of “2”.
<wml>
This deck generates the following interface in the user agent (as shown on a 6150 model phone):
A card with a single-choice list.
NOKIA WAP TOOLKIT
37
Developer’s Guide
Working with WML elements
Multiple-choice list The following example specifies a multiple-choice list. Note the following: n
The “dog” and “cat” options would be pre-selected if the variable “I” had not been previously set.
n
If the user were to choose the “cat” and “horse” options, the variable “X” would be set to “C;H” and the variable “I” would be set to “2;3”.
<wml>
This deck generates the following interface in the user agent (as shown on a 6150 model phone):
A card with a multiple-choice list.
38
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
Using links The anchor and a elements specify the head of a link. The tail of a link is specified as part of other elements, for example, a card name attribute. Note that it is a WML syntax error to nest anchored links. You can use anchors anywhere formatted text is legal, except for option elements. An anchored link must have an associated task that specifies the behavior when the anchor is selected. You must anchor one of the following task elements to a link: n
go
n
prev
n
refresh
Note that it is a WML syntax error to specify more than one task in either an anchor or a element. The following is a simple example of how to use the anchor element:
Component
Explanation
Specifies the head of a link.
Specifies a task binding to the link.
title="link_title"
Specifies a brief text string identifying the link. For it to work well with a broad range of user agents, keep your labels under 6 characters.
For more detailed information on the anchor and a elements and how to use them, refer to the WML Reference.
NOKIA WAP TOOLKIT
39
Developer’s Guide
Working with WML elements
Link example The following WML deck includes a link to the file.wml. When the user activates the link, the user agent navigates to the file.wml and sets the specified variable. <wml>
The deck generates the following user interface in the user agent:
A card containing a link.
Using timer The timer element implements a card timer, which can be used to process inactivity or idle time. The timer is initialized and started at card entry and stopped when the card is exited. The value of a timer will decrement from the initial value, triggering the delivery of an ontimer event when the timer reaches the value zero. It is a WML syntax error to have more than one timer in a card. The timeout value is specified in units of one-tenth (1/10) of a second. However, note that you should not expect a particular timer resolution. The following is a simple example of how to use the timer element:
40
Component
Explanation
Start tag of the timer element.
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
Component
Explanation
ontimer="/next"
Specifies an intrinsic event that instructs the user agent to go to the URL /next after the timer has expired.
name="name"
Specifies the name of the variable to be set with the value of the timer. The variable named by the name attribute will be set with the current timer value when the card is exited or when the timer expires.
value="50"
Specifies the timeout value in units of one-tenth of a second. This attribute indicates the default value of the variable named in the name attribute. This attribute is required.
Note the following: n
Each time the card of the example above is entered, the timer is reset to the value of the variable key.
n
If name is not set, the timer is set to a value of 5 seconds.
n
The text “Hello World!” is displayed for five seconds, after which the user agent goes to the URL /next.
For more detailed information on the attributes of the timer element and how to use it, refer to the WML Reference.
Intrinsic events Several WML elements can generate events when the user interacts with them. These intrinsic events indicate state transitions inside the user agent. WML includes four intrinsic events described in the following table. Event
Element(s)
Description
ontimer
card, template
The ontimer event occurs when a timer expires. You can specify a timer using the timer element.
NOKIA WAP TOOLKIT
41
Developer’s Guide
Working with WML elements
Event
Element(s)
Description
onenterforward
card, template
The ontenterforward event occurs when the user enters a card using a go task or any method with identical semantics. The ontenterforward intrinsic event may be specified at both the card-level and decklevel. Event bindings specified in the template apply to all cards in the deck and can be overridden.
onenterbackward
card, template
The onenterbackward event occurs when the user navigates into a card using a prev task or any method with identical semantics. In other words, the onenterbackward event occurs when the user navigates into a card by using an URL retrieved from the history stack. The onenterbackward intrinsic event may be specified at both the card-level and decklevel. Event bindings specified in the template apply to all cards in the deck and can be overridden.
onpick
options
The onpick event occurs when the user selects or deselects this item.
You can specify that certain tasks are to be executed when an intrinsic event occurs in two ways. First, you can specify an URL to be navigated to when the event occurs. This event binding is specified in a well-defined element-specific attribute, which is the equivalent of a go task. For example:
Second, you can use an expanded version of the method above, which gives you more control over user agent behavior. An onevent element is implemented within a parent element, specifying the full event binding for a particular intrinsic event. For example, the following is identical to the previous example:
42
NOKIA WAP TOOLKIT
Working with WML elements
Developer’s Guide
However, the user agent treats the attribute syntax as an abbreviated form of the onevent element where the attribute name is mapped to the onevent type.
Displaying text The following sections introduce the text formatting elements of WML.
Emphasis The emphasis tags specify text emphasis markup information. The emphasis tags are explained in the following table. Tag
Explanation
em
Render with emphasis.
strong
Render with strong emphasis.
i
Render with an italic font.
b
Render with a bold font.
u
Render with underline.
big
Render with a large font.
small
Render with a small font.
Use the strong and em tags where possible. It is not recommended to use the b, i and u tags except where explicit control over text presentation is required.
NOKIA WAP TOOLKIT
43
Developer’s Guide
Working with WML elements
Text format example The following WML illustrates the use of text emphasis tags. <wml>
Toolkit
When displayed, this card generates the following user interface:
Card with text formatting.
Note that the user agent can only display a few lines at a time and so you must scroll down through the display to see the last lines of the card.
Line breaks To start a new line in display text, simply insert a
tag where you want to start the line. Note that adding a carriage return or line feed has no effect: the WML compiler treats it as a single space.
Text wrapping and alignment The p element establishes both the line wrap and alignment parameters for a paragraph. WML has two line-wrapping modes for visual user agents: breaking (or wrapping) and non-breaking (or non-wrapping). The current line wrap mode controls how lines too long to fit on the screen are treated. n
44
If mode="wrap" is specified, the line is word-wrapped onto multiple lines. In this breaking mode, line breaks should be inserted into a text flow as appropriate for presentation on an individual device, and any space between words is a legal line breaking point.
NOKIA WAP TOOLKIT
Working with WML elements
n
Developer’s Guide
If mode="nowrap" is specified, the line is not automatically wrap. In this nonbreaking mode, the user agent must provide a mechanism to view entire nonwrapped lines (horizontal scrolling, for example, or some other user-agentspecific mechanism.
Any space between words is a legal line break point. The non-breaking space entity ( or ) indicates that the user agent must not treat the space as a space between words. It is recommended that you use to prevent unwanted line breaks. The soft-hyphen character entity ( or ) indicates a location that may be used by the user agent for a line break. If a line break occurs at a softhyphen, the user agent inserts a hyphen character (-) at the end of the line. In all other operations, the soft-hyphen entity is ignored. Note also that a user agent may ignore soft-hyphens when formatting text lines. The p tag establishes both the new wrap and alignment parameters for a paragraph. If the wrap mode is not specified, it is identical to the line–wrap mode of the previous paragraph in the current card. If the text alignment is not specified, it defaults to left. Empty paragraphs, such as an empty element or an element with only insignificant white space, should be considered as insignificant and ignored by visual user agents. Insignificant paragraphs do not impact line-wrap mode. If the p element in a card does not specify a line-wrap or alignment mode, that mode defaults to the initial mode for the card. The user agent must insert a line break into the text flow between significant p elements.
table element You can use the table element, with the tr and td elements, to create sets of aligned columns of text and images in a card. The table elements determine the structure of the columns. The elements separate content into columns, but do not specify column or intercolumn widths. The user agent does its best effort to present the information of the table in a manner appropriate to the device. Note that you cannot nest table elements. The alignment of the text and images within a column is specified by the align attribute. You can align the contents of a column center, left, or right. The align attribute value is interpreted as a list of alignment designations, one for each column. You specify center alignment with the value “C”, left alignment with the value “L”, and right alignment with the value “R”. The first designator in the list applies to the first column, the second designator to the second column, and so on. The default alignment is applied for any column for which an alignment designation is omitted. For left-to-right languages, the default alignment is left. For right-to-left languages, the default alignment is right. You must use the columns attribute to specify the number of columns for the row set. The user agent must create a row set with exactly the number of columns specified by the columns attribute value. If the actual number of columns in a row is less than the value specified in the columns attribute, the row must be effectively padded with empty columns. The orientation of the table depends on the language: for left-to-right languages, the leftmost column is the first column in the table.
NOKIA WAP TOOLKIT
45
Developer’s Guide
Working with WML elements
Columns are added to the right side of a row to pad left-to right tables. Columns are added to the left side of a row to pad right-to left tables. If the actual number of columns in a row is greater than the value specified by the columns attribute, the extra columns of the row must be aggregated into the last column, such that the row contains exactly the number of columns specified. A single inter-word space must be inserted between two cells that are being aggregated. Depending on the display characteristics, the user agent may create aligned columns for each table, or may use a single set of aligned columns for all tables in a card. To ensure the narrowest display width, the user agent should determine the width of each column from the maximum width of the text and images in that column. A non-zero width gutter must be used to separate each non-empty column. The following example contains a card with a single column group, containing two columns and three rows. <wml>
One Two 1 B C
D
Specifies a container to hold a single table cell data within a table row. Table data cells may be empty. Empty cells are significant, and must not be ignored. The user agent should do a best efrort to deal with multiple line data cells that may result from using images or line breaks. columns="2" Specifies the number of columns for the row set. align="L" Specifies the layout of text and images within the columns of a row set. NOKIA WAP TOOLKIT Working with WML elements Developer’s Guide For more detailed information on the table, tr, and td elements and how to use them, refer to the WML Reference. Special characters WML supports both named and numeric character entities. Note that all numeric character entities are referenced with respect to the document character set (Unicode) and not to the current document encoding (charset). This means that the notation { always refers to the same logical character, independent of the current character encoding. WML supports the following character entity formats: n Named character entities, such as & and < n Decimal numeric character entities, such as { n Hexadecimal numeric character entities, such as The following table illustrates the seven named character entities that are particularly important in the processing of WML. Entity Notation Explanation quot " quotation mark amp & ampersand apos ' apostrophe lt < less than gt > greater than nbsp non-breaking space shy soft hyphen (discretionary hyphen) To include a special character, simply use the escaped notation described in the table above. For example, the following code includes a less than character (<) in the escaped form <. <wml> Numerically 5 < 10 NOKIA WAP TOOLKIT 47 Developer’s Guide Working with WML elements This would generate the following user interface: Use of special characters. 48 NOKIA WAP TOOLKIT WMLScript This chapter discusses the features of the Wireless Markup Language Script (WMLScript) language and how to use them. WMLScript is part of the WAP application layer, and you can use it to add client side procedural logic to WML cards and decks. The language is based on ECMAScript, but it has been modified to better support low bandwidth devices such as mobile phones. Refer to the Glossary on page 69 for definitions of new terms used in this chapter. Overview of WMLScript The Wireless Application Protocol (WAP) includes WMLScript, a scripting language that you can use with Wireless Markup Language to provide intelligence to the client services. WMLScript can also be used as a standalone tool. With WMLScript, you can overcome the following limitations of WML: n You can check the validity of user input. n You can access facilities of the user agent. For example, on a mobile phone, allowing the programmer to make phone calls, send messages, add phone numbers to the address book or access the SIM card. n You can generate messages and dialogs locally, thus allowing alerts, error messages, confirmations etc to be seen faster by the user. n You can build extensions to the user agent software and configure a user agent after it has been deployed. For a detailed presentation of WMLScript, refer to the WMLScript Reference. See also the currency converter and mortgage calculation examples in the section “Example applications” on page 61. NOKIA WAP TOOLKIT 49 Developer’s Guide WMLScript WMLScript standard libraries The following table briefly describes the WMLScript standard libraries. For more information, refer to the WMLScript Reference. Library Description Float This library contains a set of typical arithmetical floating-point functions that are frequently used by applications. String This library contains a set of string functions. URL This library contains a set of functions for handling absolute URLs and relative URLs. WMLBrowser This library contains functions that WMLScript uses to access the associated WML context. Dialogs This library contains a set of typical user interface functions. WMLScript non-standard libraries WMLScript contains the non-standard debug library that contains a set of debugging functions. These functions help you debug script applications. For more information, refer to the WMLScript Reference. WML and WMLScript example The next example illustrates a WML deck containing two cards and a separate WMLScript file: n The first card (card1) calls the WML script random.wmls and requests the function getRandom that generates a random number. n The second card (card2) shows the result of the WMLScript operation. n The script file random.wmls generates a random number and returns the result to the second card of the WML deck. For more information on the WML elements and WMLScript functions of this example, refer to the WML Reference and WMLScript Reference. 50 NOKIA WAP TOOLKIT WMLScript Developer’s Guide WML code <wml> Select Random <do type="accept" label="Random">Result: $(RESULT) WMLScript code The script does the following: n Generates a random number between 0 and 100. The random number is stored in the variable r. n Sets the variable RESULT with the random value r. n Sends the result to card2 of the WML file random.wml and refreshes its variable values. extern function getRandom () { var r = Lang.random(100); WMLBrowser.setVar("RESULT", r); WMLBrowser.go("random.wml#card2"); } NOKIA WAP TOOLKIT 51 Developer’s Guide 52 WMLScript NOKIA WAP TOOLKIT Security This chapter discusses the security issues of WML services, and provides an overview of how to create WML services so that security risks are minimized. Refer to the Glossary on page 69 for definitions of new terms used in this chapter. Access element When you specify an URL, you gain access to all the variables it uses. To give you control over this potential security risk, WML supports access control performed with the access element. You can use the access element in the deck header to specify access control for the entire deck. The following is a simple example of how to use the access element: <wml> Card content Component Explanation Start tag of a head element. A head element can contain an access and a meta element. Start tag of an access element. domain="domain" path="path" A deck’s domain and path attributes specify the other decks that can access it. NOKIA WAP TOOLKIT 53 Developer’s Guide Security n For example, given the following access control attributes: domain="acmecorp.com" path="/pub" — The following decks would be allowed to access this deck: acmecorp.com/pub/stocks.cgi www.acmecorp.com/pub/demos/packages.cgi — The following decks would not be allowed to access this deck: www.test.net/pub www.acmecorp.com/internal/foo.wml n The default access control settings let you access any URLs in the same domain. The WAP user agent uses the domain and path attributes to determine which URLs can access the deck. The user agent uses a prefix match to compare the URLs of decks trying to access your deck with the attribute values you define. The following table lists the elements that let you navigate between decks and the associated access settings the target deck must specify. Element Access requirements prev None. go href="href" The deck located at the specified href must specify domain and/or path attributes that match the URL of the requesting deck. For more information on the access element and how to use it, refer to the WML Reference. Access control example In the following example, the access element is used to restrict access to the deck containing this element. Only decks in the network location “mycompany.com/WML” are allowed access to this deck. 54 NOKIA WAP TOOLKIT Security Developer’s Guide Writing secure WML The following WML elements and attributes help to reduce security risks when creating WML services. Element Attribute Explanation access domain Enables access to specified decks. A deck’s domain and path attributes specify the other decks that can access it. path go ! NOKIA WAP TOOLKIT sendreferer Specifies whether the user agent should provide the URL of the current deck when requesting the specified URL. Setting sendreferer="true" causes the device to specify the deck URL in the HTTP_REFERER request header. Note: The Nokia WAP Toolkit 1.2 does not support HTTP-S addresses or Secure Socket Layers (SSL). 55 Developer’s Guide 56 Security NOKIA WAP TOOLKIT Web server This chapter provides information on how to configure your web server for WML and WMLScript services. Refer to the Glossary on page 69 for definitions of new terms used in this chapter. MIME types Before creating your own WML and WMLScript services, configure your web server to support the following MIME types: Content MIME type Extension WML source text/vnd.wap.wml wml Wireless bitmaps image/vnd.wap.wbmp wbmp Compiled WML application/vnd.wap.wmlc wmlc WMLScript source text/vnd.wap.wmlscript wmls Compiled WMLScript application/vnd.wap.wmlscriptc wmlsc To find out how to configure the MIME types of your web server, contact your server vendor. NOKIA WAP TOOLKIT 57 Developer’s Guide Web server HTTP headers included in the server To generate HTTP responses that a web server will accept, your service must have the correct HTTP headers. The following table lists the HTTP headers you should use when communicating with a web server. HTTP header Usage Content-type The Content-type header is required. It can specify any of the following MIME types: text/vnd.wap.wml application/vnd.wap.wml-wbxml text/vnd.wap.wmlscript application/vnd.wap.wmlscriptc These types are described above in “MIME types”. charset The charset header specifies the document character set. For example, Content-type: text/vnd.wap.wml; charset=UTF-8 Content-length The Content-length header is optional. The Nokia WAP Toolkit 1.2 ignores this header. Content-encoding The Content-encoding header is optional. The Nokia WAP Toolkit 1.2 ignores this header. Cache-Control The Cache-Control header controls how the data is cached to the Nokia WAP Toolkit. For example, Cache-Control: no-cache specifies that the data is not cached at all. 58 NOKIA WAP TOOLKIT Web server Developer’s Guide Character sets By default, the web server transcodes data for your application according to the HTTP headers specified by your application. For example, if you provide a deck containing an entry card and the HTTP header for the deck specifies the ISO-88591 character set, the web server returns the text the user enters in the deck in ISO8859-1 characters. To determine which character set your application expects, the web server also looks at the accept-charset attribute of the go element returning the data. If the HTTP header of the deck does not specify a character set, the web server uses the accept-charset attribute to determine the character set. You should set the accept-charset attribute for all go elements that return data. For example, if your service uses the ISO-8859-1 character set, it could be specified in a do task as follows: Enter your company name: The Nokia WAP Toolkit supports the following character set names that you can specify for the charset parameter in HTTP headers and the go element’s acceptcharset attribute. Use the names shown below to ensure that the character set is handled correctly. n ISO-8859-1 n UTF-8 n ISO-10646-UCS-2 NOKIA WAP TOOLKIT 59 Developer’s Guide 60 Web server NOKIA WAP TOOLKIT Example applications This section contains two simple “real-life” applications of WML and WMLScript, one for converting currency values, the other for calculating mortgage payments. You can find both of these examples in the \samples directory under the Nokia WAP Toolkit installation directory (by default, C:\Program Files\Nokia\WAPToolkit). Currency converter The following WML and WMLScript example demonstrates an application that converts currency values between US dollars, German Marks, French Francs and the Finnish Markka. The currency exchange rates are according to the Federal th Reserve Bank of America’s published rates of October 29 1998. This example code is also provided as the currency.wml and currency.wmls files in the Nokia WAP Toolkit. WML code <wml> Amount: <select name="from" value="USD" title="From:"> <select name="to" value="FIM" title="To:"> The currency rates were obtained from the Federal Reserve Bank of New York on $(date). <do type="prev" label="Back"> <prev/> WMLScript code /* * Return the date when the data was generated. * *@param varName - the variable to store the results */ extern function getInfoDate(varName) { WMLBrowser.setVar(varName,"October 29 1998"); WMLBrowser.refresh(); } /* * Calculate the exchange rate * *@param varName - the variable to store the results *@param amount - the amount to convert *@param from - the original currency *@param to - the currency to convert to *@return a string containing the converted amount; or an error * if "from" and/or "to" is not supported. */ extern function convert(varName,from,to,amount) { var multiplier = 0.0; var returnString = "Not Available"; var result; 62 NOKIA WAP TOOLKIT Example applications Developer’s Guide if (from == "DEM") { /* * German Mark */ var DEM_FIM = 0.328728; var DEM_FRF = 0.298331; var DEM_USD = 1.653500; if (to == "DEM") multiplier = 1.0; else if (to == "FIM") multiplier = DEM_FIM; else if (to == "FRF") multiplier = DEM_FRF; else if (to == "USD") multiplier = DEM_USD; } else if (from == "FIM") { /* * Finnish Markka */ var FIM_DEM = 3.042032; var FIM_FRF = 0.907533; var FIM_USD = 5.030000; if (to == "FIM") multiplier = 1.0; else if (to == "DEM") multiplier = FIM_DEM; else if (to == "FRF") multiplier = FIM_FRF; else if (to == "USD") multiplier = FIM_USD; } else if (from == "FRF") { /* * French Franc */ var FRF_DEM = 3.351981; var FRF_FIM = 1.101889; var FRF_USD = 5.542500; if (to == "FRF") multiplier = 1.0; else if (to == "FIM") multiplier = FRF_FIM; else if (to == "DEM") multiplier = FRF_DEM; else if (to == "USD") multiplier = FRF_USD; } else if (from == "USD") { /* * US Dollar */ var USD_DEM = 0.604778; var USD_FIM = 0.198807; var USD_FRF = 0.180424; NOKIA WAP TOOLKIT 63 Developer’s Guide Example applications if (to == "USD") multiplier = 1.0; else if (to == "FIM") multiplier = USD_FIM; else if (to == "FRF") multiplier = USD_FRF; else if (to == "DEM") multiplier = USD_DEM; } if (multiplier != 0.0) { /* * Make the calcualtion */ result = amount / multiplier; returnString = String.toString(result); returnString = String.format("%.2f", returnString); } /* * Return the results to the browser */ WMLBrowser.setVar(varName,returnString); WMLBrowser.refresh(); } Explanation When you navigate to the deck, the WML encoder will generate the following user interface (as shown on a 6110 model phone): Press the Options button. Press Select to choose Edit Amount. In the card that appears, enter the currency amount by using your computer keyboard or the keypad of the simulator phone. The default value is 0. You can delete the last digit entered by pressing Clear. Note that you can enter only numbers. The interface now looks like: 64 NOKIA WAP TOOLKIT Example applications Developer’s Guide Press OK to return back to the first card. Next, select from which currency you want to convert the specified amount. n Press the button with the up and down arrow to scroll down through the display and move the cursor to the currency from which you want to convert. n Press Options, select Select List Item, and press Select. n The button in front of the currency is now checked and the display looks like: Next, select the currency to which you want to convert the specified value. n Press the button with the up and down arrow to scroll down through the display and move the cursor to the currency to which you want to convert. n Press Options to select the item. select the currency. The button in front of the currency is now checked and the display looks like: Finally, calculate the converted value: n Press Options to go to the option menu. n In the option menu, select Calculate and press Select. n You are brought back to the currency card. Scroll down through the display to see the last line. The display now looks like: NOKIA WAP TOOLKIT 65 Developer’s Guide Example applications The last line shows the result of the calculation. Mortgage payment calculator The following WML and WMLScript example demonstrates a simple application for calculating mortgage payments. This example code is also provided as the mortgage.wml and mortgage.wmls files in the Nokia WAP Toolkit. WML code <wml> Principal:
WMLScript code /* * Calculate a mortgage’s payment * *@param varname the variable name to store the result *@param principal the principal *@param interest the interest rate *@param num_payments the number of payments *@return the payment */ extern function payment(varname, principal, interest, num_payments) { /* * Interest formulae: * * If (i != 0), then: * pmt = principal * [i * (1+i)^n / ((1+i)^n - 1)] * * If (i == 0), then: * pmt = principal / n */ var mi = interest/1200; // monthly interest from annual percentage var payment = 0; if (mi != 0) { var tmp = Float.pow((1 + mi), num_payments); payment = principal * (mi * tmp / (tmp - 1)); } else { if (num_payments != 0) payment = principal / num_payments; } var s; if (payment != 0) s = String.format("$%6.2f", payment); else s = "Missing data"; /* * Send the result to the browser */ WMLBrowser.setVar(varname, s); NOKIA WAP TOOLKIT 67 Developer’s Guide Example applications /* * Make sure the browser updates its current card */ WMLBrowser.refresh(); }; Explanation When you navigate to the deck, the WML encoder will generate the following user interface (as shown on a 6150 model phone): This card displays the default values for principal, interest and number of payments. To change the value of a field, go to the value line by pressing the button with the up and down arrow, and press Options. From the Options screen, choose to edit the value and press Select. The following interface appears: In this display, enter the new value: n Empty the display by pressing Clear. n Enter the new value by using your computer keyboard or the keypad of the simulator phone. Note that you can enter only numbers. n When you are done, press OK to return to the first card. You can delete the last digit entered by pressing Clear. Set the values similarly for all the fields. After entering all the values, press OK to return to the first card and scroll down through the display to see the last line. The last line shows the monthly mortgage payment. 68 NOKIA WAP TOOLKIT Glossary The following terms and conventions are used throughout this document. American Standard Code for Information Interchange (ASCII) ASCII is a standard developed by the American National Standards Institute (ANSI) to define computer-intelligible values for characters used in text. The ASCII set of 128 characters includes upper-case and lower-case letters of the English alphabet, numbers, punctuation, and 33 control codes (such as tab, bell, carriage return). ASCII uses 7 bits to represent each character. You may see ASCII characters identified by a decimal number from 0 to 127. The standard ASCII character set uses just 7 bits for each character, consequently one bit of each octet is not used. Larger character sets, known as extended ASCII or high ASCII, use all 8 bits, allowing as many as 128 additional characters to be defined. Numerous extensions to ASCII have been devised and quite a few have become national or international standards. Notable among them is a family of international standards, ISO-8859, that defines extensions appropriate to certain language groups which ASCII alone cannot support. The most important member of this group is ISO-8859-1, known as ISO Latin-1, which provides for the languages of western Europe. Attribute A syntactical component of a WML element which is often used to specify a characteristic quality of an element, other than type or content. Author An author is a person or program that writes or generates WML, WMLScript or other content. Bandwidth Bandwidth is the capacity that a telecommunications medium has for carrying data. For analog or voice communication, bandwidth is measured in the difference between the upper and lower transmission frequencies expressed in cycles per second, or hertz (Hz). For digital communication, bandwidth and transmission speed are usually treated as synonyms and measured in bits per NOKIA WAP TOOLKIT 69 Developer’s Guide Glossary second. The actual speed or transmission time of any message or file from origin to destination depends on a number of factors. Most Internet transmissions travel at very high speed on fiber optic lines most of the way. Switching en route, lower bandwidths on local loops at both ends, and server processing time add to the overall transmission time. Byte A sequence of consecutive bits treated as a unit. On almost all modern computers, a byte is comprised of 8 bits, though other numbers were formerly encountered. To avoid ambiguity, the term octet is used in the language of international standards to refer to an 8-bit unit. Large amounts of memory are indicated in terms of kilobytes (1,024 bytes), megabytes (1,048,576 bytes), and gigabytes (approximately 1 billion bytes). A disk that can hold 1.44 megabytes, for example, is capable of storing approximately 1.4 million ASCII characters, or about 3,000 pages of information. Bytecode Content encoding where the content is typically a set of low-level opcodes, that is, instructions, and operands for a targeted piece of hardware or virtual machine. Card A single WML navigational and user interface unit. A card may contain information to present to the user or instructions for gathering user input, for example. Character Encoding When used as a verb, character encoding refers to conversion between sequence of characters and a sequence of bytes. When used as a noun, character encoding refers to a method for converting a sequence of bytes to a a sequence of characters. Typically, WML document character encoding is captured in transport headers attributes, meta information placed within a document, or the XML declaration defined by the XML specification. Client A device or application that initiates a request for connection with a server. 70 NOKIA WAP TOOLKIT Glossary Developer’s Guide Common Gateway Interface (CGI) A programming language that enables you to use forms on your web site. Concatenation Concatenating two strings means sticking them together, one after another, to make a new string. For example, the string “foo” concatenated with the string “bar” gives the string “foobar”. Content Subject matter stored or generated at a web server. Content is typically displayed or interpreted by a user agent in response to a user request. Content encoding When used as a verb, content encoding indicates the act of converting content from one format to another. Typically the resulting format requires less physical space than the original, is easier to process or store and/or is encrypted. When used as a noun, content encoding specifies a particular format or encoding standard or process. Content format Actual representation of content. Deck A collection of WML cards. A WML deck is also an XML document. Device A network entity that is capable of sending and receiving packets of information and has a unique device address. A device can act as both a client or a server within a given context or across multiple contexts. For example, a device can service a number of clients as a server while being a client to another server. NOKIA WAP TOOLKIT 71 Developer’s Guide Glossary Document Type Definition (DTD) The document type definition states which elements can be nested within others. A DTD defines: — The names and contents of all elements that are permissible in a certain document. — How often an element may appear. — The order in which the elements must appear. — Whether the start or end tag may be omitted. — The contents of all elements, that is, the names of the other generic identifiers that are allowed to appear inside them. — The attributes and their default values. — The names of the reference symbols that may be used. Element Elements specify all the markup and structural information for a WML deck. Elements may contain a start tag, content and an end tag. Extensible Markup Language (XML) The Extensible Markup Language is a World Wide Web Consortium (W3C) standard for Internet markup languages, of which WML is one such language. XML is a restricted subset of SGML. Hypertext transfer protocol (HTTP) HTTP is the underlying protocol used by the World Wide Web. HTTP defines how messages are formatted and transmitted, and what actions web servers and browsers should take in response to various commands. For example, when you enter an URL in your browser, an HTTP command is sent to the web server directing it to retrieve and transmit the requested web page. JavaScript™ A de facto standard language that can be used to add dynamic behaviour to HTML documents. 72 NOKIA WAP TOOLKIT Glossary Developer’s Guide Markup Text added to the data of a document to convey information on it. There are four different kinds of markup: descriptive markup (tags), references, markup declarations, and processing instructions. Rendering Formatting and presenting information. Resource A network data object or service that can be identified by an URL. Resources may be available in multiple representations (for example, multiple languages, data formats, size and resolutions) or vary in other ways. Server A device or application that passively waits for connection requests from one or more clients. A server may accept or reject a connection request from a client. Standardized Generalized Markup Language (SGML) The Standardized Generalized Markup Language is a general-purpose language for domain-specific markup languages. SGML is defined in the ISO8879 standard. Tag A tag is a generic term for a language element descriptor. WML consists of content surrounded by formatting tags. Each tag is enclosed in a pair of angle brackets: < and >. Tags are generally used in pairs, one to start the element and one to end it. Terminal A device providing the user with user agent capabilities, including the ability to request and receive information. Also called a mobile terminal or mobile station. Transcode The act of converting from one character set to another, for example, conversion from UCS-2 to UTF-8. NOKIA WAP TOOLKIT 73 Developer’s Guide Glossary Unicode An encoding scheme for written characters and text. Unlike ASCII, which uses 7 bits for each character, Unicode uses 16 bits, which means that it can represent more than 65,000 unique characters, a huge increase over ASCII’s code capacity of 128 characters. Unicode was authored and is maintained by the Unicode Consortium, a group comprised of major corporations and institutions involved in international computing. The character repertory and the codes assigned in Unicode are identical to those specified by ISO 10646, the international Universal Character Set (UCS) standard. The Unicode Standard, Version 2.0 defines codes for characters used in every major language written today. In all, the Unicode standard currently defines codes for nearly 39,000 characters from the world’s alphabetic, ideographic and syllabic scripts and symbol collections. The Unicode repertory was derived from many pre-existing character set standards to which previously unstandardized characters have been added. In particular, the first 256 code values are identical to those of ISO 8859-1 extended to 16 bits. Unicode values are displayed as four hex digits preceded by U+. For example, U+0041 is Latin upper case A. Uniform Resouce Identifier (URI) Uniform Resource Identifiers (URI) identify resources in the web: documents, images, downloadable files, services, electronic mailboxes, and other resources. A URI can refer to an Uniform Resource Locator (URL) or an Uniform Resource Name (URN). Uniform Resource Locator (URL) URL stands for Uniform Resource Locator and is an address referring to a document on the Internet. The syntax of an URL consists of three elements: — The protocol, or the communication language, that the URL uses. — The domain name, or the exclusive name that identifies a web site. — The pathname of the file to be retrieved. User A user is a person who interacts with a user agent to view, hear, or otherwise use a resource. User agent A user agent is any piece of software or physical device that interprets WML, WMLScript, WTAI or other resources. They may include textual browsers, voice browsers and search engines, for example. 74 NOKIA WAP TOOLKIT Glossary Developer’s Guide Web server The server on which a given resource resides or is to be created. Often referred to as an origin server or an HTTP server. Wireless Application Environment (WAE) The Wireless Application Environment specifies a general-purpose application environment based fundamentally on World Wide Web technologies and philosophies. WAE specifies an environment that allows operators and service providers to build applications and services that can reach a wide variety of different platforms. WAE is part of the Wireless Application Protocol. Wireless Application Protocol (WAP) The Wireless Application Protocol specifies an application framework and network protocols for wireless devices such as mobile phones, pagers, and personal digital assistants (PDAs). The WAP specifications extend mobile networking technologies (such as digital data networking standards) and Internet technologies (such as XML, URLs, scripting, and various content formats). Wireless Markup Language (WML) The Wireless Markup Language is a markup language based on XML and is intended for use in specifying content and user interface for narrowband devices, including mobile phones and pagers. Wireless Markup Language Script (WMLScript) A scripting language used to program the mobile device. WMLScript is an extended subset of the JavaScript™ scripting language. Wireless Session Protocol (WSP) The Wireless Session Protocol provides the upper-level application layer of WAP with a consistent interface for two session services. The first is connection-mode service that operates above a transaction layer protocol, and the second is a connectionless service that operates above a secure or nonsecure datagram transport service. NOKIA WAP TOOLKIT 75 Developer’s Guide 76 Glossary NOKIA WAP TOOLKIT Index Configuring MIME types, 57 A a element, 20, 39 Access control, 53 access element, 14, 53 Content-encoding, 58 Content-length, 58 Content-type, 58 Alignment, 44 D amp character, 47 Decimal numeric character entities, 47 Ampersand character, 47 Deck, 7 multiple, 23 anchor element, 20, 39 Anchors, 20 do element, 16 apos character, 47 Document type declaration (DTD), 11 Apostrophe character, 47 Dollar sign character, 27 Attributes, 10 E B Elements, 8 br element, 21 Emphasis, 43 Entities, 8 C Events, 16 Cache-Control, 58 Example applications, 61 Card, 7 Extensible Markup Language, 1 multiple, 23 card element, 13, 14 F Case sensitivity, 11 fieldset element, 20 Character entities Formatting text, 43 decimal numeric, 47 hexadecimal numeric, 47 named, 47 Character format, 34 Character sets, 59 charset, 58 Commenting code, 10 Components of Nokia WAP Toolkit, 4 NOKIA WAP TOOLKIT alignment, 44 emphasis, 43 line breaks, 44 line wrapping, 44 special characters, 47 table element, 45 tables, 45 td element, 46 tr element, 46 77 Developer’s Guide Index Nokia WAP Toolkit G Glossary, 69 go element, 17, 18 Greater than character, 47 gt character, 47 components, 4 Non-breaking space character, 47 noop element, 17, 19 O onenterbackward element, 16, 42 H head element, 14 Header, 11 Hexadecimal numeric character entities, 47 onenterforward element, 16, 42 onevent element, 16 onpick element, 16, 42 ontenterforward element, 42 History stack, 26 ontimer element, 16, 41 HTTP headers, 58 optgroup element, 20 option element, 20 I Images, 20 P img element, 20 p element, 21 input element, 20, 31 postfield element, 16 Intrinsic events, 41 prev element, 17, 19 Introduction to WML, 7 Q L quot character, 47 Less than character, 47 Quotation mark character, 47 Line breaks, 44 R Line wrapping, 44 Links, 13, 39 refresh element, 17, 19 Related documents, 5 lt character, 47 S M Samples, 61 meta element, 14 MIME types, 57 Minimizing security risks, 55 Modes line wrapping, 44 Multiple cards, 23 decks, 23 Security, 53, 55 select element, 20, 35 Select lists, 35 shy character, 47 Soft hyphen character, 47 Special characters, 47 Special characters of WML, 47 N T Named character entities, 47 table element, 21, 45 nbsp character, 47 78 NOKIA WAP TOOLKIT Index Developer’s Guide Tables, 45 Tag, 8 Task elements, 17 Tasks go, 18 noop, 19 prev, 19 refresh, 19 td element, 21, 46 template element, 14, 24 Text formatting, 21 alignment, 44 emphasis, 43 line breaks, 44 special characters, 47 table element, 45 td element, 46 text wrapping, 44 tr element, 46 Text input, 31 Text wrapping, 44 timer element, 20, 40 Timers, 20, 40 tr element, 21, 46 Typographical conventions, 5 U User input, 20, 31 V Variables, 10, 19, 27 naming, 27 setting, 28 substituting, 29 W Web server, 57 anchor element, 20, 39 br element, 21 card element, 13, 14 deck, 7 do element, 16 elements, 13 fieldset element, 20 formatting text, 43 go element, 17, 18 head element, 14 header, 11 img element, 20 input element, 20, 31 intrinsic events, 41 introduction, 7 meta element, 14 noop element, 17, 19 onenterbackward element, 16, 42 onenterforward element, 16, 42 onevent element, 16 onpick, 42 onpick element, 16, 42 ontimer element, 16, 41 optgroup element, 20 option element, 20 p element, 21 postfield element, 16 prev element, 17, 19 refresh element, 17, 19 security, 53 select element, 20, 35 special characters, 47 structure, 11 table element, 21 tasks, 17 td element, 21 template element, 14, 24 text formatting, 43 timer element, 20, 40 tr element, 21 variables, 27 wml element, 11, 13 Wireless Application Protocol (WAP), 1 wml element, 13 Wireless Markup Language, 1 WML syntax WML. See Wireless Markup Language a element, 20, 39 access control, 53 access element, 14, 53 NOKIA WAP TOOLKIT attributes, 10 case sensitivity, 11 comments, 10 elements, 8 79 Developer’s Guide Index entities, 8 tags, 8 variables, 10 WMLScript, 49 non-standard libraries, 50 standard libraries, 50 80 X XML. See Extensible Markup Language declaration, 11 version number, 11 NOKIA WAP TOOLKIT Related DocumentsDev GuideNovember 2019 17Dev-guideNovember 2019 17Blazeds Dev GuideDecember 2019 18Cfmx7 Dev GuideOctober 2019 52Dev Tools GuideApril 2020 5Paybook Guide Dev FrJune 2020 12 |