Because the Openwave extensions are not covered by the current WML specification, remember to reference their DTD instead at the beginning of the WML document as follows: Using the an
Trang 1The V
translation service
Trang 2<parent 1>
<element 1>
</element 1>
</parent 2>
<parent 2>
<element 2>
</element 2>
</parent 2>
The Openwave extensions take this concept a stage further By dividing the
tasks you wish to carry out into a hierarchical series and applying context to the
specific children, it becomes much easier to handle such things as the user inter-face, the use of variables, and the exchanging of information between contexts
Navigation within the current context is possible in WML using the <go>
and <prev> elements However, using the Openwave extensions, we can carry on further to provide contextual navigation Because the Openwave extensions are not covered by the current WML specification, remember to reference their DTD instead at the beginning of the WML document as follows:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN"
"http://www.phone.com/dtd/wml11.dtd" >
Using the <spawn> and <catch> Extensions
The <spawn> element allows navigation from a parent to a child in a similar way
to a <go> task However, using the <spawn> element spawns a new nested
con-text.When this context is exited, the user is returned to the parent context.This may seem somewhat trivial, but the use of <spawn> allows users to browse a number of possible cards within this context while returning to the parent con-text in one move (as opposed to <go>/<prev> where all viewed cards would have to be navigated through to reach the parent card).This can be a powerful way to manage how the user navigates by condensing many frustrating clicks into one click
<spawn href="url.wml">
</spawn>
Trang 3The <spawn> tag can contain the <catch> element to trap any errors:
<spawn href="url.wml">
<catch/>
</spawn>
Using the <exit> and <throw> Extensions
In addition to the <prev> task, the <exit> and <throw> extensions allow navi-gation back to the parent context As noted previously, <throw> allows excep-tions to be trapped and handled accordingly using <catch>.The <exit> element
is used to cater for a specific eventuality, returning the user to the parent context where the spawn attribute <onexit> is used to specify what should happen:
<do type="options" label="Return">
<exit/>
</do>
<do type="options" label="Exit">
<throw name="abort"/>
</do>
Using the <catch> Extension
The <catch> element provides a series of mechanisms to trap errors.This very useful element allows different situations to be dealt with accordingly For
example, if the user cancels a request, you may want to handle what happens as a result differently than, say, the user encountering an error from the server:
<card>
<do type="accept" label="Choice">
<spawn href="submit.wml" onexit="#success">
<catch name="error" onthrow="#error1"/>
<catch name="cancel" onthrow="#error2"/>
</do>
</card>
Trang 4Using the <send> and <receive> Extensions
When the user returns to the parent context, you may want to bring back some information with them as the result of a task that was carried out.The <send>
and <receive> elements allow data to be sent from the nested child context and received in by the parent context.The following is an example of using <send>:
<card>
<send value="x"/>
<send value="y"/>
</card>
The following is an example of using <receive>:
<card>
<receive name="value1"/>
<receive name="value2"/>
</card>
The ordering of the names and values is important In the preceding
examples, the receiving deck will assume that the value for value1 will be
x and that the value for value2 will be y If y appeared before x, the
value of value1 would be y.
Preloading URLs
The <link> element is used to preload a URL into the device, and you should use it only when you know that the user will probably want to follow this link A common use may be to preload the next page in a news item.The link element
is placed within the head of the document:
Trang 5<link href="next_url.wml" rel="next"/>
</head>
WML Editors, WAP SDKs, and Emulators
A whole plethora of tools are available to the aspiring wireless developer.They range from freeware and shareware items to full-blown SDKs from phone manu-facturers such as Nokia and Openwave.Those with a degree of experience using HTML editors will be pleased to know that most of the popular HTML editors support editing WML
WML Editors
If you are comfortable with hand-coding WML, Allaire’s Homesite is a great editor that comes with the ability to work with WML Although not immediately apparent, you can enter WML and use the context-sensitive menus to access all the various attributes, as shown in Figure 3.7 Homesite is inherently extensible,
so if you don’t like how it does things, you can always rewrite it
Figure 3.7Allaire Homesite
Trang 6If you aren’t quite ready to work with raw WML code, the Macromedia WML Studio extension may interest you Developed by Nokia, the WML Studio allows the creation of WML pages from within Macromedia’s popular editor Dreamweaver
The Nokia WML Studio for Dreamweaver is an extension to Dreamweaver that you can download from the Macromedia Web site It allows the creation of WML content within Dreamweaver’s what you see is what you get
(WYSIWYG) environment, as shown in Figure 3.8
The extension includes a WML 1.1 parser, error notification, plus the ability
to show previews of the WML content
At the time of this writing, the WML Studio was not compatible with Macromedia UltraDev 1 or UltraDev 4 and is unfortunately not available
Figure 3.8Macromedia Dreamweaver Together with the WML Studio Extension from Nokia
Trang 7EasyPad WAPtor (shown in Figure 3.9) is a simpler WML editor available for Windows users It allows the easy creation of WAP pages and in fact is specifically designed to ease WML creation.WAPtor features syntax highlighting to allow the WML to be more easily navigated and also has a content preview pane so you can see how you are doing at any time.The preview is limited, however (for example, there is no provision for handling WMLScript), but it can be helpful when getting started
Supporting WML 1.1,WAPPage 2.1 allows the easy creation and mainte-nance of WML content without users necessarily needing to know too much about WML.WAPPage shows the content in an emulated WAP handset, and you can navigate the WML content by using the built-in tree view.The compiler allows you to quickly locate errors and projects help you group files together As with many other editors, it features syntax highlighting but also features drag-and-drop WML editing
Figure 3.9EasyPad WAPtor
Trang 8Other Editors
Many other editors are available, some freeware, some shareware, and others full-blown retail products, so you should easily be able to find the editor that suits your style of working.The following list covers some of the more well-known editors:
■ Card Oneoffers a simple point-and-click interface to WML creation and is available from www.peso.de/wap_en/index.htm
■ DotWAPis a basic but popular editor for creating WML files and is available from www.inetis.com/freeware.asp
■ Santana Builderis a WML editor for the more advanced developer that can connect to databases for complex interactive site creation and is available from www.inetis.com/santanabuilder.asp
■ WAPPageis a WML editor with drag-and-drop functionality, visual editing, and helpful syntax highlighting together with a number of ways
of previewing WML.WAPPage is available from www.zyglobe.com/products.html
■ Wap Pro 2.0features extensive support for the WML standard and also allows code created for dynamic applications using ASP, PHP3, and Cold Fusion among others and is available from www.wapemperor.com
■ WBuilder Espresso is a template-based editor that features WYSIWYG
editing,WML site previews, and site publishing WBuilder Pro is also
available and offers workflow solutions.You can find both at www.3tl.com/products/espresso/index.htm or www.3tl.com/
products/pro/index.htm
■ WML Writer is a simple WML creation editor reminiscent of Microsoft’s WordPad but features syntax highlighting and the creation of full WML files.WML Writer is available from http://inin-wap.avalon.hr/
zdravko/index.htm
■ XML Spyis a full-featured XML editing tool for those who want max-imum control.You can use XML Spy to create WML files For the more experienced user at home with the various WML elements, XML Spy provides XML validation, custom schema, DTD editing and creation, and more XML Spy is available at www.xmlspy.com
Trang 9WAP SDKs
WAP SDKs offer a number of tools to developers to speed the creation of WAP sites.They generally contain at least a WML editor and an emulator to view con-tent in Some even go as far as to include a dedicated WAP gateway to simulate live requests and other tools such as WBMP creation and manipulation tools.The following sections outline the features of several WAP SDKs
Ericsson WapIDE SDK
Available through registration at the Ericsson Developers’ Zone
(www.ericsson.com/developerszone), the WapIDE SDK enables the development and testing of WAP applications for Ericsson phones
The SDK simulates the R320s, R380s, and R520m Ericsson phones and includes an application designer facilitating the creation and testing of WML applications Additionally, the inclusion of a push initiator allows push messages to
be sent to the WapIDE browser or real device
The SDK will run on Microsoft Windows NT 4.0,Windows 98, or Windows
2000 and requires Java 2 Platform, version 1.3.0 or later
Motorola Mobile ADK
The Motorola Mobile ADK is available to individual developers who register at the Motorola Applications Global Network (MAGNET) It allows the developer
to create and simulate WML applications targeted towards Motorola devices.You can find additional information at www.motorola.com/developers/wireless
Nokia WAP Toolkit
Nokia WAP Toolkit 2.1 includes WML,WMLScript,WBMP, and multi-part edi-tors plus simulaedi-tors for various Nokia phones It also includes debugging tools, a push simulator, and sample applications
The SDK is available to registered users and will run on Microsoft Windows
NT 4.0,Windows 98, or Windows 2000 and requires Java 2 Platform, version 1.3.0 or later A minimum 300MHz Pentium with 128Mb of RAM is recom-mended.You can find additional information at http://forum.nokia.com
Openwave UP.SDK
The UP.SDK allows applications to be developed targeting devices that utilize
Trang 10simulator for Windows and relevant developer documentation, UP.Link notifica-tion library and tools, plus sample applicanotifica-tion source code For addinotifica-tional infor-mation, visit http://developer.openwave.com
WAPObjects
The WAPObjects framework tightly integrates with Apple’s popular WebObjects framework Featuring drag-and-drop integration with WebObjects builder and support for databases and Enterprise Resource Planning (ERP) systems, WAPObjects allows rapid application development targeted at wireless users
Additional information is available at www.wapobjects.com/wapobjects/en
WML Emulators
WML emulators add the facility to view your WML decks in an emulation of a phone device.These emulators vary wildly in how they render content and how closely this compares to actual real-life deployment of a finished application
Although emulators are useful, there is no substitute for real-world testing using actual devices over live public networks For emulators specific to the phone manufacturers, check the previous WAP SDK listing
■ M3Gate (www.m3gate.com/m3gate) M3Gate allows you to surf WAP sites from the comfort of your PC and is launched when you encounter a WAP address in your browser It can be custom-designed according to your needs for corporate applications
■ Virtual WAPJag (www.wapjag.com/news/virtual.php) Link to the Virtual WAPJag to launch a browser window displaying the WAP site’s content
■ WAPAka (www.wapaka.com) A free WAP microbrowser written in WAP that can be used within Web browsers or Palm,Windows CE, and Linux operating systems
■ YOSPACE SmartPhone Emulator (www.yospace.com) A well-known WAP emulator that can be placed on a Web site with a huge variety of skins and sizes to choose from
■ WinWAP PRO (www.wap-shareware.com/directory/
wapemulators/winwappro.shtml) A microbrowser available for a number of devices.The Palm OS and Windows versions are publicly