About the author
Let's assume that you wanted to implement a RSS 2.0 feed for your corporate news, using Delphi 8.
Let's further assume that you already have the following fields defined, in the Table named News.
Now, start up Delphi 8, and create a new ASP.NET project. Switch to ASPX view for the new form, and insert the following code, replacing everything in the ASPX view from after the Page directive onwards. Make sure you set the ContentType attribute to "text/xml" for the Page directive.
<%@ Page language="c#" Debug="true" Codebehind="rss.aspx.pas" AutoEventWireup="false" Inherits="NewsEntry.wfRSS" ContentType="text/xml"%><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>My Site News</title><link>http://mysite.org/news.aspx</link><description>My Site News RSS 2.0 feed</description><language>en-us</language><asp:repeater id="Items" runat="server" datasource="<%# dataView1 %>"><itemtemplate><item><title><%#DataBinder.Eval(Container.DataItem, "DisplayDate", "{0:d MMM yyyy}")%></title><description><%#Server.HtmlEncode(DataBinder.Eval(Container.DataItem,"NewsText").ToString())%></description><pubDate><%#DataBinder.Eval(Container.DataItem, "DisplayDate", "{0:ddd, dd MMM yyyy HH:mm:ss zz'00'}") %></pubDate><link>http://mysite.org/news.aspx#<%#DataBinder.Eval(Container.DataItem, "DisplayDate", "{0:dMMMyyyy}")%><%#DataBinder.Eval(Container.DataItem, "NewsID")%></link></item></itemtemplate></asp:repeater></channel></rss>
Then, switch to design view, from the Data Explorer, drag the table which contains your news to the form. Right click on the BdpDataAdapter, and use it to create a Typed Dataset. Next, drag a DataView and placed it on the form. Now, switch to code view. When you switch to code view, you'll find that the Delphi 8 IDE have already automatically created the declarations for the repeater. Now, you need to insert the following code into the Page_Load event.
BdpDataAdapter.Fill(dataSet1, 'News');dataView1.Table = dataSet1.News;dataView1.RowFilter = String.Format('#{0:dd/MMM/yyyy}# >= AppearDate', DateTime.Today);dataView1.Sort := 'NewsID DESC';Items.DataBind;
Simple isn't it? Well, that was all I had to do to create a RSS 2.0 feed for my other sites anyway.
I'm using a Delphi 8 Architect Trial, and therefore, the instructions given for the above may or may not differ slightly from your Delphi 8 edition.
This article discusses the new Delphi 8 property access specifiers.
Continued discussion of undocumented Delphi 8 Property Access Specifiers, and other ways of adding and removing delegates / events handlers, including clearing the list of all the delegates / event handlers.