Skip Headers

Oracle9iAS Wireless Developer's Guide
Release 2 (9.0.2)

Part Number A90485-02
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

3
Displaying and Formatting Content

Each section of this document presents a different topic. These sections include:

3.1 Hello World Example

The first example shows how to display the traditional "Hello World" content on a mobile device.

3.1.1 HelloWorld.xml

<?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>

Figure 3-1 Hello World content on mobile devices

Text description of xmla.gif follows.

Text description of the illustration xmla.gif

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.

3.1.2 DOCTYPE Declaration

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.

3.1.3 SimpleResult

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.

3.1.3.1 SimpleContainer

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.

3.1.3.2 DeckExample.xml

<?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>

Figure 3-2 Cards displayed on mobile telephones

Text description of xmlb.gif follows.

Text description of the illustration xmlb.gif

3.1.3.3 SimpleText, SimpleTextItem

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>


Note:

The .wav file specified must be in CCITT mu-law, 8 bit, 8kHz.


3.2 Formatting the Display

3.2.1 SimpleBreak, SimpleStrong and SimpleEm

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.

3.2.1.1 FormattingExample.xml

<?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>

Figure 3-3 Results of formatting example

Text description of xmlc.gif follows.

Text description of the illustration xmlc.gif

3.2.2 Tables and Basic Formatting Example

3.2.2.1 SimpleTable, SimpleTableHeader, SimpleTableBody, SimpleRow and SimpleCol

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.

3.2.2.2 TableExample.xml

<?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>

Figure 3-4 Results of tables and basic formatting example

Text description of xmld.gif follows.

Text description of the illustration xmld.gif

3.3 Wireless Graphics

3.3.1 SimpleImage

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.

3.3.2 ImageDisplay.xml

<?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>

Figure 3-5 Results of image example

Text description of xmle.gif follows.

Text description of the illustration xmle.gif

3.4 Enhancing with Audio for Voice Access

3.4.1 SimpleAudio and SimpleSpeech

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>

Figure 3-6 Results of SimpleAudio and SimpleSpeech example

Text description of xmlf.gif follows.

Text description of the illustration xmlf.gif

3.4.2 Recommendation for Voice Navigation

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:

  1. Write a basic version of the service using exactly the same flow and markup for small-screen devices and audio interfaces.

  2. Test on small-screen devices and voice telephones. If it is acceptable, you are done.

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.

  1. First, there are a number of attribute values that can be adjusted to enhance the interface for one of the device classes.

  2. Second, if that is insufficient, one can selectively include or exclude certain elements from the user interface depending on the deviceclass.

  3. Finally, one can alter the user interface flow by selectively following different paths through a service, again, depending on the deviceclass.


Go to previous page Go to next page
Oracle
Copyright © 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index