Channel Definition Format (CDF) is an application of the Extensible Markup Language (XML) that gives you the ability to offer automatic information delivery to client browsers in the form of channels. CDF uses special data files to define logical groupings and scheduling for a set of channels, and this sample will demonstrate how one of these CDF files can be created dynamically.
In general, .cdf files look quite a bit like .htm files. Each channel definition is contained within the <CHANNEL> tags, and includes the channel title, description, and schedule information. A list of the actual channel items follows, each item marked with the <ITEM> tags.
In this example, the channel configuration is already specified, and the script builds the rest of the .cdf file from a text file. The FileSystemObject.OpenTextFile method is used to open the text file, which is simply a list of title string-link string pairs, each element on a new line of the file. The script then iterates through the file, using the ReadLine method in a Do loop, writing a new <ITEM> entry to the client browser for each title-link pair contained in filelist.txt.
Note While the CDF output that is sent to the client browser by the server has a lot in common with HTML, it is important to note that HTML and CDF are not one in the same. HTML and CDF look similar because both are essentially markup languages defined by SGML and XML, but CDF is an independent entity from HTML. For that reason, it is important that the content-type of the output be set to application/x-cdf. You can do this either explicitly, using the Response.ContentType property, or implicitly, by giving the ASP script which is creating the CDF file a .cdx extension. In the latter case, ASP automatically sets the appropriate content-type for any output generated by the script.
For more information about CDF, visit the Microsoft Web site at www.microsoft.com, and the World Wide Web Consortium's Web site at www.w3.org/.
The VBScript and JScript versions of this script are available in the IIS samples directory, at ...\asp\interaction\CDF_VBScript.asp and ...\asp\interaction\CDF_JScript.asp.