Data files are used to deliver incremental data for a channel, and are only used in scripted channels. Data files are simple text files that contain data with one item per line. Within the CDF file, a structure for the data file may be declared using an ITEMFORMAT tag, as discussed earlier.
Each Mobile Channels data file name must have a .mcd extension. The CDF file must include an ITEM tag to define the MCD file. Within the ITEM tag, the ID attribute is used as a shorthand reference for the MCD file from within a script without having to reference its complete URL.
Unlike the conventional approach, where script files are run and call their server for data to display, Mobile Channels does the opposite for displaying incremental data. Because new information can come in at any time within a new MCD file, it is more efficient to activate the script to display data when it arrives.
The file format for data files is flexible. It is simply a text file that contains the data, such as references to images, with each item on a separate line. Mobile Channels exposes methods within the scripting environment for reading this content from the file.
The ITEMFORMAT tag is used to specify the type of data present in the file. Generally, files have the following format.
[Header Block]
[Data Block 1]
[Data Block 2]
. . .
[Data Block n]
Each block may consist of zero or more fields, as specified in the ITEMFORMAT tag. This allows a single data file to be used as a simple database with rows of data. Data items are organized in the structure, as specified by the following ITEMFORMAT tag:
<ITEMFORMAT VALUE="TITLE,DATE,PICTURE=IMG;NAME,LOW,HIGH,CLOSE"/>
The first block is the header block, which contains general information such as a title, date, and image. The remaining repeating data blocks follow the header block.
Note The different blocks are commented for the purpose of illustration. Comments should not be present in any MCD file. There should be a carriage return at the end of each data file.
Stock Info 'header block
April 24, 1997
ClintonPic
MSFT 'data block 1
110.25
112.50
111.00
DEC 'data block 2
21
23
22
IBM 'data block 3
132.50
132.75
132.75