Special Edition Using HTML 4

Previous chapterNext chapterContents


- 30 -
Building Channels with CDF

by Jerry Honeycutt

Introducing Webcasting

Webcasting is the capability to broadcast content to the user on a regular schedule. You decide how much content to download and how often to update it using a Channel Definition File (CDF). Microsoft's incarnation of this standard, which you can learn more about at W3C's Web site, is called Active Channels.

A user subscribes to your channel using his Web browser, which allows him to monitor the channel for changes and browse its content offline. The browser notifies the user when content is added to or changed on your channel by displaying a starburst (a gleam in Microsoft vernacular) next to the channel's icon. Optionally, if the user enables the mail notification for the subscription, the browser sends an Internet mail message to the user.

Broadcasting a channel requires three steps on your part, each of which you learn about in this chapter: designing the channel, building the CDF file, and posting your channel to the Internet. You can get really fancy and add your channel to Internet Explorer Channel Guide as well, which advertises your content to everyone using Internet Explorer.

Designing Channels

A channel is nothing more than Web pages; still, users have very different expectations. They expect much more panache with a channel. For starters, keep these notes in mind when organizing your channel:

You can deliver that extra punch if you follow these recommendations:


TIP: You can learn how to build great channels by learning from the publishing professionals. Look at your favorite magazines to see how they lay out pages for advertisements, editorials, and so on. Visit some of the more popular channels on the Internet to see how they design their content.

Creating a CDF File

A CDF file is an index of HTML files that make up your channel. In it, you specify the update schedule, channel hierarchy, page titles, abstracts, and more. You can download only the CDF to the user's computer, which causes the user to have to go online to browse the channel's content, or you can download the CDF file and all the updated content. Keep in mind that in many cases, the user can override your settings in the CDF file so that more or less content is downloaded.

CDF is an application of XML. As with HTML, you store CDF tags in a text file--only you give it the CDF file extension. The syntax is even similar to HTML tags. You begin and end each tag with brackets, for example. Some tags are containers, requiring a start and end pair, while other tags are empty tags. With CDF, you put a slash before the closing bracket of empty tags. Here's an overview of each type of syntax (empty tag, container tag, and child tags):

Empty tag with attributes: <TAG ATTR="VALUE" ATTR="VALUE" />

Container tag with attributes: <TAG ATTR="VALUE">This is the content</TAG>

Container tag with child tags: <TAG ATTR="VALUE"> <CHILD1>This is the content</CHILD1> <CHILD2 ATTR> </TAG>


NOTE: In HTML, you don't have to quote the value that you assign to an attribute as long as that value doesn't contain spaces. For example, HREF=./html/file.htm is valid. With CDF, you have to quote each and every value, however, or the parser might not work. For example, HREF="./html/file.htm".

Each CDF file includes at least one <CHANNEL> tag, which defines the top-level channel. You can nest <CHANNEL> tags to create a hierarchy of channels with the first <CHANNEL> tag representing the top-level and the tags nested under that representing the first level. Each <ITEM> tag points to a Web page in the channel. The most basic CDF file looks like the one shown in Listing 30.1 (you'll build upon this example throughout this chapter).

Listing 30.1  A Basic CDF File

<?XML version="1.0"?>
<!DOCTYPE Channel SYSTEM "http://www.w3c.org/Channel.dtd">
<CHANNEL HREF="http://www.honeycutt.com/channel.html">
</CHANNEL>

The first two lines describe the contents of the file as an XML implementation, pointing the browser to http://www.w3c.org/Channel.dtd for the Channel DTD. The last two lines show you how to specify the opening page of the channel using the <CHANNEL> tag's HREF attribute. This is the Web page the user sees when he opens your channel in the channel viewer. You can optionally include the BASE attribute to include the base URL for the channel, which the browser uses to resolve relative URLs.

Describing Your Channel's Hierarchy

You can nest one <CHANNEL> within another to create a hierarchy of channels--the outside tag presents the top level, the tags nested in that represent the first level, and so on. For example, if you nest three of these tags, one within another, the user would see the first-level subchannel when he clicks on the top level. When the user clicks the first level, he'd see the second level. Figure 30.1 illustrates this by showing you a typical channel in Internet Explorer's Channel Bar.

The <CHANNEL> tag describes a channel hierarchy, but the <ITEM> tag refers to the Web pages that make up the content of your channel. When the user clicks a channel containing <ITEM> tags, he sees a list of Web pages. While you can nest <CHANNEL> tags within each other, you can't nest <CHANNEL> or <ITEM> tags within another <ITEM> tag. HREF is a required attribute that you set to the URL of the Web page for that item. Optionally, set LASTMODE to the date the item was last changed in the form YYYY-MM-DD:THHMM+HHMM and LEVEL to the number of levels below the item to download to the user's cache.

FIG. 30.1
The user can also browse a channel's hierarchy in Internet Explorer's Favorites menu.

Listing 30.2 shows you an example of a channel with a complex hierarchy. When the user opens the top level, he sees the Web page indicated by HREF in the browser; the subchannels and items indicated by this tag's child tags will appear in the Channel Bar. If the user opens the second subchannel, he'd see two items and an additional channel he can click. Note the use of relative URLs, which are resolved against the topmost container tag in this case.

Listing 30.2  A Complex CDF File

<?XML version="1.0"?>
<!DOCTYPE Channel SYSTEM "http://www.w3c.org/Channel.dtd">
<CHANNEL HREF="http://www.honeycutt.com/channel.html" BASE="http://www.honeycutt.com">
    <ITEM HREF="intro.html"></ITEM>
    <CHANNEL HREF="more/stuff.html">
        <ITEM HREF="books.html"></ITEM>
        <ITEM HREF="bio.html"></ITEM>
        <ITEM HREF="tips.html"></ITEM>
    </CHANNEL>
    <CHANNEL HREF="other/stuff.html">
        <ITEM HREF="games.html"></ITEM>
        <ITEM HREF="tricks.html"></ITEM>
        <CHANNEL HREF="deep/stuff.html">
            <ITEM HREF="cdf.html"></ITEM>
        </CHANNEL>
    </CHANNEL>
</CHANNEL>


NOTE: Using the <ITEM> tag has little to do with the browser's crawler, the software that downloads the channel to the user's computer. The crawler actually analyzes the links in each Web page to determine what it should download. The <CHANNEL> and <ITEM> tags express the relationships between Web pages so that the browser can display that relationship in the Channel Bar.


Nesting CDF Tags
CDF allows you to nest tags in interesting ways. By doing this, you can build interesting hierarchies for your channel. The following table describes how you can nest the CDF tags described. For example, you can put an <ABSTRACT> tag within a <CHANNEL> and an <ITEM> tag.
Tag Child Tags Parent Tags
<ABSTRACT> <CHANNEL>
<ITEM>
<CHANNEL>
<ABSTRACT>
<CHANNEL>
<ITEM>
<LOG>
<LOGIN>
<LOGO>
<LOGTARGET>
<SCHEDULE>
<TITLE>
<EARLIESTTIME> <SCHEDULE>
<INTERVALTIME> <SCHEDULE>
<ITEM> <ABSTRACT> <CHANNEL>
<LOG>
<LOGO>
<TITLE>
<USAGE>
<LATESTTIME> <SCHEDULE>
<LOG> <ITEM>
<LOGIN> <CHANNEL>
<LOGO> <CHANNEL>
<ITEM>
<LOGTARGET> <PURGETIME> <CHANNEL>
<PURGETIME <LOGTARGET>
<SCHEDULE> <EARLIESTTIME> <CHANNEL>
<INTERVALTIME> <ITEM>
<LATESTTIME>
<TITLE> <CHANNEL>
<ITEM>
<USAGE> <ITEM>


Scheduling Updates to Your Channel

You can create a default schedule that determines the frequency at which the browser checks for changes, updating the user's computer with fresh content. You specify a range of times, and the browser randomly picks a time within that schedule. Doing so, the browser avoids overwhelming the server because the load is spread out across the entire time range. A user who connects to the Internet via a dial-up connection updates his channels manually, though, so the server will get hits throughout the day.

To schedule your channel, you must first specify how much content to download to the user's computer. Set the <CHANNEL> tag's LEVEL attribute to the number of levels you want to download to the user's computer. For example:

<CHANNEL HREF="http://www.honeycutt.com/channel.html" LEVEL="3">

Then, you specify the schedule using the <SCHEDULE> tag. This tag has two attributes, STARTDATE and ENDDATE, that indicate the range of dates that the schedule applies. The format for these attributes is YYYY-MM-DD--for example, 1998-02-14. If you omit these attributes, the schedule starts with the current day. You specify the interval at which to update the content using the <INTERVALTIME> child tag. You set DAY to the number of days over which the schedule repeats, HOUR to the number hours, and MIN to the number of minutes. Thus, to update the content every day and a half, you'd write an <INTERVALTIME> tag that looks like this: <INTERVALTIME DAYS=1 HOUR=12>.

Listing 30.3 shows you an example that schedules a channel to be updated once every six hours beginning on 10/1/97 and ending on 11/1/97.

Listing 30.3  Scheduling the Download

<?XML version="1.0"?>
<!DOCTYPE Channel SYSTEM "http://www.w3c.org/Channel.dtd">
<CHANNEL HREF="http://www.honeycutt.com/channel.html" LEVEL="3">
    <SCHEDULE STARTDATE="1997-10-01" ENDDATE="1997-11-1">
        <INTERVALTIME HOUR="6" />
    </SCHEDULE>

</CHANNEL>

You can optionally specify a range of time, occurring at each interval, for which the browser will download updated content. For example, if you only want the browser to download content starting one hour after the interval and ending five hours after the interval, you'd set the <EARLIESTTIME> and <LATESTTIME> tags as shown in Listing 30.4. Both of these tags accept the same attributes as the <INTERVALTIME> tag.

Listing 30.4  Using <EARLIESTTIME> and <LATESTTIME>

<?XML version="1.0"?>
<!DOCTYPE Channel SYSTEM "http://www.w3c.org/Channel.dtd">
<CHANNEL HREF="http://www.honeycutt.com/channel.html" LEVEL="3">
    <SCHEDULE STARTDATE="1997-10-01" ENDDATE="1997-11-1">
        <INTERVALTIME HOUR="6" />
        <EARLIESTTIME HOUR="1" />
        <LATESTTIME HOUR="5" />
    </SCHEDULE>

</CHANNEL>

The schedule you add at the top level is the default schedule for the entire channel, but you can create separate schedules for each nested subchannel or item. Note in Listing 30.5, you don't see the STARTDATE or ENDDATE attributes, indicating that the schedule begins immediately and never expires. The very last schedule shows you how to schedule the update for an individual Web page. If an item's LASTMOD attribute indicates that the content hasn't changed recently, the browser will not download fresh content for the item.

Listing 30.5  Scheduling Each Subchannel and Item

<?XML version="1.0"?>
<!DOCTYPE Channel SYSTEM "http://www.w3c.org/Channel.dtd">
<CHANNEL HREF="http://www.honeycutt.com/channel.html" BASE="http://www.honeycutt.com">
    <SCHEDULE>
        <INTERVALTIME DAY="1" />
    </SCHEDULE>
    <ITEM HREF="intro.html"></ITEM>
    <CHANNEL HREF="more/stuff.html">
        <SCHEDULE>
            <INTERVALTIME HOUR="3" />
        </SCHEDULE>
        <ITEM HREF="books.html"></ITEM>
        <ITEM HREF="bio.html"></ITEM>
        <ITEM HREF="tips.html"></ITEM>
    </CHANNEL>
    <CHANNEL HREF="other/stuff.html">
        <ITEM HREF="games.html"></ITEM>
        <ITEM HREF="tricks.html"></ITEM>
        <CHANNEL HREF="deep/stuff.html">
            <ITEM HREF="cdf.html">
                <SCHEDULE>
                    <INTERVALTIME HOUR="3" />
               </SCHEDULE>
            </ITEM>
        </CHANNEL>
    </CHANNEL>

</CHANNEL>

Describing Your Channel in the Channel Bar

When the user is browsing the Channel Bar, he can use additional help figuring out what's what. You provide a title for each channel and item using the <TITLE> tag. Include this tag as a child of each <CHANNEL> or <ITEM>. The user sees this title next to the channel's icon in the Channel Bar, instead of seeing the URL by default. Here's what the <TITLE> tag looks like:

<TITLE>Title of Item</TITLE>

You provide a brief description of each channel and item using the <ABSTRACT> tag. The browser displays this as a ToolTip when the user holds the mouse pointer over the item in the Channel Bar. Keep the description short, a few sentences at most, and make sure it accurately describes the content of the item. This tag can be a child of both <CHANNEL> and <ITEM>. Here's what this tag looks like:

<ABSTRACT>This is the description to display in a tool-tip</ABSTRACT>

The last tag you use to describe your channel is the <LOGO> tag, which describes the images used to represent an item in the Channel Bar. The browser displays the icon next the item's title. You can specify a 16x16 icon or a 32x80 image to use as a logo. The browser uses the 32x80 logo in the Channel Bar and the 16x16 icon everywhere else. You can use any standard image format including GIF or JPG, and, in some cases, you can use a Windows ICO file for the 16x16 icon. You assign the URL of the image to the <LOGO> tag's HREF attribute. Then, you define the type of image by assigning one of the values in Table 30.1 to the STYLE attribute. <LOGO> is an empty tag, as shown here:

<LOGO HREF="http://www.honeycutt.com/image.gif" STYLE="ICON" />

Table 30.1  Image Types

Type Size Description
ICON 16x16 Represents the channel or item and is displayed next to the title
IMAGE 32x80 Represents the channel at the top level of the Channel Bar

Listing 30.6 builds upon the example you've worked on up to this point. It adds the <TITLE>, <ABSTRACT>, and <LOGO> tags to each channel and item in the CDF file. Remember that I recommend you only provide icons for the top and first levels of your channel hierarchy and let the browser take care of the rest. Do include a title and abstract for each and every level, though, so you can give the reader as much information as possible while he navigates the Channel Bar.

Listing 30.6  Describing Your Channel

<?XML version="1.0"?>
<!DOCTYPE Channel SYSTEM "http://www.w3c.org/Channel.dtd">
<CHANNEL HREF="http://www.honeycutt.com/channel.html" BASE="http://www.honeycutt.com">
    <TITLE>Jerry's Wild and Crazy HTML Channel</TITLE>
    <ABSTRACT>I give you the latest information about HTML shenanigans.     </ABSTRACT>
    <ICON HREF="images/channel.gif" />
    <SCHEDULE>
        <INTERVALTIME DAY="1" />
    </SCHEDULE>
    <ITEM HREF="intro.html">
        <TITLE>Introduction</TITLE>
        <ABSTRACT>A description of what you find in this channel</ABSTRACT>
        <ICON HREF="images/intro.gif" />
    </ITEM>
    <CHANNEL HREF="more/stuff.html">
        <TITLE>More Stuff</TITLE>
        <ABSTRACT>The latest and greatest stuff about HTML</ABSTRACT>
        <ICON HREF="images/stuff.gif" />
        <SCHEDULE>
            <INTERVALTIME HOUR="3" />
        </SCHEDULE>
        <ITEM HREF="books.html">
        <TITLE>Books</TITLE>
        <ABSTRACT>A list of all my books to date.</ABSTRACT>
        </ITEM>
        <ITEM HREF="bio.html">
            <TITLE>Biography</TITLE>
           <ABSTRACT>Jerry's biography</ABSTRACT>
        </ITEM>
        <ITEM HREF="tips.html">
            <TITLE>Tips for HTML authors</TITLE>
            <ABSTRACT>Check here for the latest HTML tips</ABSTRACT>
        </ITEM>
    </CHANNEL>
    <CHANNEL HREF="other/stuff.html">
        <TITLE>Other stuff about the Internet</TITLE>
        <ABSTRACT>The latest information about other Internet standards 	  </ABSTRACT>
        <ICON HREF="images/other.gif" />
        <ITEM HREF="games.html"></ITEM>
        <ITEM HREF="tricks.html"></ITEM>
        <CHANNEL HREF="deep/stuff.html">
            <ITEM HREF="cdf.html">
                <SCHEDULE>
                    <INTERVALTIME HOUR="3" />
               </SCHEDULE>
            </ITEM>
        </CHANNEL>
    </CHANNEL>
</CHANNEL>

Logging Hits While the User Is Offline

CDF provides a mechanism for recording hits to your channel while the user is browsing it offline. This is the only way you're going to be able to track usage information for it. To enable the browser to track hits for you, you must add the <LOG> tag to each <ITEM> container in your channel. This tag's only attribute is VALUE, to which you assign the event to be logged. Currently, the only value you can assign to VALUE is document:view, which logs a hit every time the user opens the HTML file causing the document:view event. For example:

<LOG VALUE="document:view" />

You tell the browser where to log hits adding the <LOGTARGET> tag to each <CHANNEL> container. This tag works similar to HTML's <FORM> tag. You assign the URL of the script that accepts log data to HREF. Then, you specify the HTTP method by assigning PUT or POST to the METHOD attribute. The SCOPE attribute indicates which hits you want logged: ALL indicates every hit, OFFLINE indicates only offline hits, and ONLINE indicates only online hits. The default value is ALL. Here's what the <LOGTARGET> tag looks like when included as part of a <CHANNEL> tag:

<CHANNEL HREF="http://www.honeycutt.com/channel.cdf">
    <LOGTARGET HREF="http://www.honeycutt.com/cgi-bin/log" METHOD="POST">
    </LOGTARGET>
</CHANNEL>

Within the <LOGTARGET> container, you can specify the range of time for which the browser reports hits using the <PURGETIME> tag. Set this tag's DAY attribute to the number of prior days for which the browser reports hits. Set the HOUR attribute to the number of hours and the MIN attribute to the number of minutes. For example, if you only want the browser to report hits for the last day and a half, use <PURGETIME> like this:

<PURGETIME DAY="1" HOUR="12" />

Authenticating a User

If you're implementing HTTP authentication on your channel, you must ensure that the browser has the user's name and password it can log onto the channel without user intervention. You do so using the empty <LOGIN> tag, which causes the browser to collect the user's name and password during the subscription process. This tag's DOMAIN attribute contains the domain name of the server that's authenticating the user--honeycutt.com, for example. The METHOD attribute indicates the type of authentication as described in Table 30.2. Here's an example:

<LOGIN DOMAIN="honeycutt.com" METHOD="BASIC">

You can provide a default username and password so that the browser can pre-fill the login wizard so the user only has to dismiss the dialog box. You assign the username to USER and password to PASS. If you don't provide the username or password, the browser prompts the user for them and won't continue the subscription process without them.


TIP: After the subscription process, you no longer have to include <LOGIN> in your CDF file as the browser stores the authentication information in the subscription information that it keeps.

Table 30.2  Authentication Types

Type Description
BASIC Plain Text. Base64 string containing the name and password.
DPA Distributed Password Authentication. Challenge-response method similar to that used by the Microsoft Network.
MSN Microsoft Network. Challenge-response method used by the Microsoft Network.
NTLM NT LAN Manager. Challenge-response method based upon the user's name.
RPA Remote Passphrase Authentication. CompuServe's authentication method.


TIP: You can use Active Server Pages to dynamically generate a CDF file based upon the user's preferences. Collect the user's preferences when he first subscribes to the channel. Then, store the preferences as HTTP cookies and dynamically build the CDF file each time the user browses your channel.

Creating a Desktop Component or Screen Saver

By default, the browser displays each item in a channel as a Web page. You can cause the browser to use an item differently, however, by including the <USAGE> tag within the <ITEM> container:


<ITEM HREF="http://www.honeycutt.com/intro.htm">
    <USAGE VALUE="ScreenSaver" />
</ITEM>

As shown in the example, the <USAGE> tag's only attribute is VALUE. This indicates how you intend for the browser to use the parent item. Table 30.3 describes each of the values you assign to this attribute.

Table 30.3  Usage Values

Value The item is:
Channel Displayed in the channel viewer
Email Mailed to the user when updated
NONE Not displayed in the Channel Bar
DesktopComponent Displayed on the user's desktop
ScreenSaver Displayed as a screen saver
SmartScreen Displayed as a screen saver


NOTE: You learn more about creating Active Desktop and Active Screen Saver items in Chapter 31, "Supporting the Active Desktop."

Posting the CDF File to Your Web Site

Your pages are ready and you've created your CDF file; now you need to post your channel on the Internet. Doing so is no different than posting your normal Web pages--copy your files to the Web server. Be sure to include your CDF file. Note that CDF files only work properly when opened from a Web server. Thus, you can't test your CDF file by opening it from your computer.

You must provide a link to your CDF file, though, so the user can launch the subscription process. You can put this link anywhere on your Web site, but you should consider building a special Web page for this link that advertises your channel. If you're broadcasting a portion of your existing Web site, include a link on the primary Web page for that portion. You can see an example of this on Microsoft's Web site: http://www.microsoft.com/msdn/sdk/inetsdk/asetup/default.htm. A text or graphical link will do the trick:

<A HREF="http://www.honeycutt.com/subscribe.cdf>Subscribe</A>
<A HREF="http://www.honeycutt.com/subscribe.cdf><IMG SRC=subscribe.gif></A>

The subscription process works something like this:

1. The user clicks the link to the channel's CDF file.

2. The browser downloads and parses the CDF file, opening a subscription window similar to the one shown in Figure 30.2.

FIG. 30.2
The user can customize the amount of content he wants and the schedule on which he wants it updated.

The user customizes the amount of content, the schedule, logon, and even the notification method, and dismisses the dialog box.

4. The browser adds the subscription information to the Channel Bar. The user can browse the channel by clicking its icon in the Channel Bar.

5. Per the schedule specified for the channel, the browser downloads a fresh copy of the CDF file; then, it checks for updated content on the channel and downloads it.


OSD for Distributing Applications
Up to this point, the primary way that publishers distribute software is through disks or CD-ROMs. Many publishers do post products on the Internet that the user can download, but the whole process is still initiated and steered by the user.
In combination with CDF, OSD (Open Software Description) promises to allow you to push software to the user's desktop in a similar way to how you use CDF to push Web content. A user subscribes to an application channel, which automatically updates the user's computer with the latest version of your application.

OSD is a technology that is co-developed by Microsoft and Marimba. Netscape and other vendors have backed it, though, and OSD has been submitted to W3C for acceptance as a recommendation. Many details are missing as of this writing, however, but you can learn more about OSD at http://www.microsoft.com/standards/osd.


Adding Your Channel to Internet Explorer's Guide

I can think of no better way to get the word out about your channel than to place it on Internet Explorer's Channel Guide. That way, everyone with a copy of Internet Explorer will see the advertisement for your channel and can subscribe to it by clicking it in the guide. Microsoft has a few rules you must follow to be listed in the channel guide:


NOTE: To submit a channel to Microsoft for inclusion in the channel guide, you must be a member of the SiteBuilder Network. You can join at http://www.microsoft.com/sitebuilder/ default.htm.

When you're convinced that your channel follows the rules, you're ready to submit your channel for review. Open http://www.microsoft.com/sbnmember/apply/ChannelApplication.asp in your browser, and you are asked to submit the following items:

Listing 30.7  Channel Guide CDF

<?XML VERSION="1.0" ENCODING="UTF-8"?>
<!DOCTYPE Channel SYSTEM "http://www.w3c.org/Channel.dtd">
<CHANNEL HREF="URL" BASE="CDF">
    <TITLE>Title</TITLE>
    <ABSTRACT>Description</ABSTRACT>
    <LOGO HREF="IMAGE" STYLE="IMAGE"/>
    <LOGO HREF="ICON" STYLE="ICON"/>
</CHANNEL>


TIP: Microsoft provides a tool called Liburnia you can use to automatically build a CDF file. You can find more information about this product at http://www.microsoft.com/sbnmember/download/default.htm. Microsoft FrontPage also helps you build CDF files quicker by providing a CDF Wizard.


Previous chapterNext chapterContents


Macmillan Computer Publishing USA

© Copyright, Macmillan Computer Publishing. All rights reserved.