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 documents each tag in detail:
The CHANSCRIPT tag is used as follows:
<CHANSCRIPT VALUE="ChannelID"/>
The CHANSCRIPT tag specifies an HTML page or a Mobile Channels script (MCS) that displays a channel. The CHANSCRIPT tag value applies to all child channels of the current channel or subchannel. Thus, every subchannel must have its own CHANSCRIPT tag unless the subchannel is script-generated and the associated script is capable of generating multiple views. 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 that renders 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 that renders the display of MCD items. ITEMSCRIPT is only used for scripted channels. 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 that renders 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 as:
<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. ITEMFORMAT is only used for scripted channels. 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 only a repeat_block exists, it must be preceded by the semicolon (;). The header block typically contains the item description. The repeatable data block contains description about items. The header_block and repeat_block are of the following form.
v1[=t1], v2[=t2],
, vi[=ti]
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 described in the following table.
Type | Description |
HTML | HTML text including markup |
TEXT | Same as HTML, but without markup |
IMG | ID of image item in CDF files |
HREF | URL to a page, for example, a data file or channel script |
A data block is merely a group of values, with 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. The following code example shows how 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.microsoft.com/Stocks.mcs" ID="Stock_S">
<USAGE VALUE="None"/>
</ITEM>
. . .
<CHANNEL ID= "Stock_C">
<TITLE>Market</TITLE>
<ITEM HREF="http://www.microsoft.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 image URL. 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 following code example which represents a news article with a title, an image, and the body of text shows that the repeat block can be omitted.
<ITEMFORMAT VALUE="TITLE, PICTURE=IMG, BODY;"/>
The following code example which represents a page with stock listings shows that the header block can be omitted. 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"/>