Additional tags recognized by Mobile Channels are described in the following table.
Tag | Description |
---|---|
CHANSCRIPT | Identifies the ID of the script file to render the channel and subchannels. |
ITEMSCRIPT | Identifies the ID of the script file to render the item data file. |
ITEMFORMAT | Defines the file structure for data files. |
The following list describes each tag in detail:
The CHANSCRIPT tag is used as follows:
<CHANSCRIPT VALUE = "ChannelID"/>
The CHANSCRIPT tag specifies a Mobile Channels script (MCS) to be used to render the display of a channel. The CHANSCRIPT tag value applies to all child channels of the current channel or subchannel. This tag supersedes the CHANSCRIPT value previously defined by a parent CHANNEL element, if any exist. The VALUE attribute specifies the ID of the ITEM element corresponding to the script to be run to render this level of the channel. For example,
<CHANSCRIPT VALUE="ChanScript1"/>
where the channel script identified by "ChanScript1" has been defined elsewhere in the CDF file, say, as follows:
<ITEM HREF="http://www.microsoft.com/channel.mcs" ID="ChanScript1">
<USAGE VALUE="None"/>
</ITEM>
The top-level CHANNEL element can have at least one CHANSCRIPT tag as the child element. Each subchannel can have at most one such tag.
The ITEMSCRIPT tag is used as follows:
<ITEMSCRIPT VALUE = "ItemID"/>
The ITEMSCRIPT tag specifies a script to be used to render the display of MCD items. The ITEMSCRIPT tag value applies to all child items of the current channel or subchannel. This tag supersedes the ITEMSCRIPT value previously defined by a parent CHANNEL element, if any exist. The VALUE attribute specifies the ID of the ITEM element corresponding to the script to run to render this level of the channel. For example,
<ITEMSCRIPT VALUE = "A_Script" />
The item script file here refers to the following ITEM element defined elsewhere in the CDF file:
<ITEM HREF="http://www.microsoft.com/items.mcs" ID="A_Script">
<USAGE VALUE="None"/>
</ITEM>
You can set the VALUE attribute to "None" or "" for the USAGE tag to prevent the script file from appearing in the Channel Explorer.
The topmost CHANNEL element can have at least one ITEMSCRIPT tag. At all other channel levels there can be at most one such tag.
The ITEMFORMAT tag is used as follows:
<ITEMFORMAT VALUE="header_block ; repeat_block"/>
The tag specifies the format of a class of MCD items by identifying the associated file structure. MCD items are simple text files that can have a unique header and a repeating block structure for record-oriented data. Special helper functions are provided in the scripting environment to access the MCD content using information contained in the ITEMFORMAT tag. Both header_block and repeat_block are optional, but at least one of them must exist. If repeat_block exists, it must be preceded by the semi-colon (;). The header block typically contains the description about the items. And the repeatable data block contains description about items. The header_block and repeat_block are of the form
v1[=t1], v2[=t2], … , vn[=tn]
Here vi is the field name of the block value and ti is the optional type of the block value. If ti is omitted, the default value "HTML" is assumed. Valid types are listed in the following table.
Type | Description |
---|---|
HTML | HTML text including markup. |
TEXT | Same as HTML. |
IMG | ID of image item in CDF files. |
HREF | URL to a page, for example, data file and channel script. |
A data block is merely a group of values. There is one value per line. Any meaningful data file should have at least one data block. For example, three data blocks might be used to show a portfolio of three stocks. In the following example, the Market mobile channel displays stock values listed in the Stocks.mcd file. The header gives the title and displays the date of the shown stocks. The data to be listed includes the name, the low price, high price, and closing prices of each stock.
<ITEM HREF="http://www.market.com/Stocks.mcs" ID="Stock_S">
<USAGE VALUE="None">
</ITEM>
. . .
<CHANNEL ID= "Stock_C">
<TITLE>Market</TITLE>
<ITEM HREF="http://www.market.com/Stocks.mcd" ID="Stock_D">
<USAGE VALUE="MobileChannel"/>
<ITEMSCRIPT VALUE="Stock_S"/>
<ITEMFORMAT VALUE ="Title,Date,Picture=IMG;
Name,Low,High,Close"/>
</ITEM>
</CHANNEL>
Here the header block has three values, Title, Date, and Picture, and the data block has four: Name, Low, High, and Close.
IMG indicates the field that represents an image, such as a JPEG or GIF file. The field value is the identifier of the item defining the URL of the image. The built-in item script creates an IMG value to display this item.
The data block may be repeated to build a table of stock prices. If the Stocks.mcd file contains a single data block, the script displays a single stock per page. If it has multiple data blocks, the script could display a table of stocks.
The repeat block can be omitted, as shown in the following example, which is represents a news article with a title, an image, and the body of text:
<ITEMFORMAT VALUE="TITLE, PICTURE=IMG, BODY"/>
The header block can also be omitted, as shown in the following example that represents a page with stock listings. The semi-colon (;) is used to indicate the value list. It is the repeat block and not a header block.
<ITEMFORMAT VALUE ="; Name, Low, High, Close"/>