Oracle9iAS Wireless Developer's Guide Release 2 (9.0.2) Part Number A90485-02 |
|
Each section of this document presents a different topic. These sections include:
The first example shows how to display the traditional "Hello World" content on a mobile device.
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult> <SimpleContainer> <SimpleText> <SimpleTextItem>Hello World</SimpleTextItem> </SimpleText> </SimpleContainer> </SimpleResult>
In this example, XML is transformed into the device-specific markup language to render on the displays of a pocket PC and a telephone. This example demonstrates the power of XML; application programmers need not have any knowledge of the target device. Oracle9iAS Wireless takes care of rendering XML into the various device screens. The following section explains the XML elements, tags and attributes used in the above example. Additionally, other tags will be discussed which can be used to display and format content on device screens or voice browsers.
It is recommended that the XML documents authored for Oracle9iAS Wireless should have DOCTYPE declaration specifying the schema version. For backward compatibility (in the absence of DOCTYPE declaration), the stylesheet for Oracle9iAS Wireless Edition 1.0 will be applied. However, if 1.0 stylesheets are not available to Oracle9iAS Wireless runtime, then Oracle9iAS Wireless 1.x stylesheets will be used regardless of DOCTYPE declaration. If no 1.x stylesheets are not found, an error will result.
SimpleResult is the root element of the Oracle9iAS Wireless XML schema. Every valid Oracle9iAS Wireless XML document must have SimpleResult as its root element. SimpleResult can contain multiple SimpleContainer blocks to allow for multi-card decks.
SimpleContainer is the root of all major block constructs such as Form, Menu and Text. Elements such as menu, text and form items can act as cards in the deck. DeckExample.xml demonstrates the usage of SimpleText as a placeholder for cards. Considering the limitation of target devices and deck size restrictions on devices, judgment should be exercised in the number of cards per deck and the total content size in a single request.
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult> <SimpleContainer> <SimpleText id="card1"> <SimpleTextItem>This is Card 1 <SimpleBreak/> <SimpleHref target="#card2">Go to Card2</SimpleHref> </SimpleTextItem> </SimpleText> <SimpleText id="card2"> <SimpleTextItem>Welcome to Card2</SimpleTextItem> </SimpleText> </SimpleContainer> </SimpleResult>
Content of SimpleTextItem are usually translated into paragraphs. SimpleTextItem can be grouped using SimpleText element. SimpleText element contains one or more SimpleTextItem. The id attribute of SimpleText tag can be used to refer to SimpleText elements as a deck. SimpleText is rendered on a separate card on WML and HDML devices. SimpleHref can be used as a child of SimpleTextItem similar to HTML anchor. See Section 4.3.1, "SimpleHref, SimpleTimer" for more information on SimpleHref. The deviceclass attribute of SimpleText and SimpleTextItem take values "pdabrowser", "pcbrowser", "voice", "microbrowser", "micromessenger", and "messenger" which directs processing for either small screen clients or voice clients. In the absence of the deviceclass attribute, the content will be rendered to both small screen devices and voice enabled devices. By default, text-to-speech (TTS) synthesis is used to represent the text enclosed in these tags. SimpleAudio tag in conjunction with deviceclass attribute can be specified to override the default behavior. For a better user experience, do not use TTS whenever voice feed is available. For voice interfaces SimpleAudio may be used. Refer to the following snippet of code for usage.
<SimpleText> <SimpleTextItem> <SimpleAudio src="http://www.domain.com/filename.wav" deviceclass="voice">Alt text for TTS if the wave file is not found. </SimpleAudio> </SimpleTextItem> <SimpleTextItem deviceclass="microbrowser"> Text for small screen devices </SimpleTextItem> </SimpleText>
These elements are used for fine-tuning the display of text content on a screen. SimpleStrong displays enclosed text in a stronger representation, usually bold. SimpleEm displays the enclosed text with emphasis, usually displayed as italicized text. For voice-enabled applications, level attribute can be used to specify the level of emphasis. Permissible values for level attribute are: strong, moderate, none and reduced.
SimpleBreak creates a new line on the page on which the tag is placed. The rule attribute can be used to display a line <hr>, for HTML output. Deviceclass can be used for directive processing of small screen or voice enabled devices, or both. For voice-enabled applications, SimpleBreak enables you to specify msecs and size attributes to control the break while delivering text. See the following example for details.
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult bgcolor="99ff99"> <SimpleContainer> <SimpleText>
<SimpleTitle>Seach Result</SimpleTitle> <SimpleTextItem> <SimpleEm level="strong">1 Entry found</SimpleEm> <SimpleBreak msecs="500"/> <SimpleStrong level="strong">Chandra Patni</SimpleStrong> <SimpleBreak/>400 Oracle Pkwy <SimpleBreak/>Redwood Shores <SimpleBreak/>CA, 94065 </SimpleTextItem> </SimpleText> </SimpleContainer> </SimpleResult>
SimpleTable displays a table. A table consists of a header and body which are abstracted by SimpleTableHeader and SimpleTableBody, respectively. The body of a table consists of SimpleRow and SimpleCol elements. Images can be used in tables cells. TableExample.xml provides an example of the table elements.
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult> <SimpleContainer> <SimpleTable > <SimpleTitle> My Portfolio </SimpleTitle> <SimpleTableHeader> <SimpleCol>Symbol</SimpleCol> <SimpleCol>Price</SimpleCol> <SimpleCol>Delta</SimpleCol> </SimpleTableHeader> <SimpleTableBody> <SimpleRow> <SimpleCol>ORCL</SimpleCol> <SimpleCol>18.32</SimpleCol> <SimpleCol>+0.24</SimpleCol> </SimpleRow> <SimpleRow> <SimpleCol>SUNW</SimpleCol> <SimpleCol>17.35</SimpleCol> <SimpleCol>+1.06</SimpleCol> </SimpleRow> <SimpleRow> <SimpleCol>CSCO</SimpleCol> <SimpleCol>20.30</SimpleCol> <SimpleCol>+0.24</SimpleCol> </SimpleRow> <SimpleRow> <SimpleCol>MSFT</SimpleCol> <SimpleCol>6647</SimpleCol> <SimpleCol>+0.28</SimpleCol> </SimpleRow> </SimpleTableBody> </SimpleTable> </SimpleContainer> </SimpleResult>
This element is used for displaying a WBMP or BMP graphic on small screen devices. GIF is also supported for HTML clients. The image resolution supported is 2-bits. src is a compulsory attribute of the SimpleImage element. Unlike HTML, the extension of the image is not specified for Oracle9iAS Wireless. Appropriate extension will be appended for the target mark up language. All the images with appropriate extension (.wbmp, .bmp) should be provided in the target directory. See the following example for usage.
Devices do not support a single format of an image. As of Release 2.0, Oracle9iAS Wireless does not support dynamic image extension conversion. Application developers can suggest the available formats of the image by specifying available attribute. The available attribute is the list of whitespace-separated values of jpg, gif, g2.gif, bmp and wbmp formats. g2.gif is grayscale/depth 2 image format, typically used for Palm. Transformers apply the following rules to determine the format.
The transformer checks the available format with the list of supported Images formats provided by the server. The server has a preferred Image formats property for each logical device. This list can contain one or all of the formats supported by the available attribute.
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult> <SimpleContainer> <SimpleText> <SimpleImage src="http://portal.oraclemobile.com/other/oow/oramobile" alt="Welcome To OracleMobile"/> </SimpleText> </SimpleContainer> </SimpleResult>
The SimpleAudio element can be used for playing audio. The file specified by the src attribute must be in 8-bit mulaw format. The SimpleSpeech element may be used to control prosody pitch and other VoiceXML text-to-speech engine parameters. For example, the class attribute can be used to specify the sayas text-to-speech output as phone, date, digits, literal, currency, number or time. See the following example for usage.
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <SimpleResult> <SimpleContainer> <SimpleText> <SimpleTextItem> <SimpleAudio src="welcome1.wav">Welcome to Oracle Mobile, India Development Center</SimpleAudio> <SimpleBreak/> <SimpleAudio src="welcome2.wav">You can contact us at phone number </SimpleAudio> <SimpleBreak/> <SimpleSpeech class="phone"> <SimpleAudio src="phone.wav">91 080 552 8335</SimpleAudio> </SimpleSpeech> </SimpleTextItem> </SimpleText> </SimpleContainer> </SimpleResult>
While writing applications for Oracle9iAS Wireless, developers should consider voice navigation at design time. Well-designed voice applications tend to have different semantics than small screen devices and desktop applications. Although Oracle9iAS Wireless automatically provides an audio interface for service, the system is not intended to be a speech-controlled small-screen device browser, where speech is added as an afterthought. Application developers should develop services that have appropriate small-screen and speech interfaces in their own right, and the respective strengths of these different devices can be used to advantage.
The development path for beginners should follow this model:
For a large class of services, particularly menu-driven services that provide information, the method works surprisingly well. If one or another interface seems clumsy, there are several things that can be done to improve it.
|
Copyright © 2002 Oracle Corporation. All Rights Reserved. |
|