Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Delphi ActiveX) Read RSS FeedSample code showing how to read an RSS feed and emit the contents.
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB; ... procedure TForm1.Button1Click(Sender: TObject); var rss: TChilkatRss; success: Integer; rssChannel: IChilkatRss; numItems: Integer; i: Integer; rssItem: IChilkatRss; numCategories: Integer; j: Integer; begin rss := TChilkatRss.Create(Self); // Download from the feed URL: success := rss.DownloadRss('http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml'); if (success <> 1) then begin Memo1.Lines.Add(rss.LastErrorText); Exit; end; // Get the 1st channel. rssChannel := rss.GetChannel(0); if (rss.LastMethodSuccess = 0) then begin Memo1.Lines.Add('No channel found in RSS feed.'); Exit; end; // Display the various pieces of information about the channel: Memo1.Lines.Add('Title: ' + rssChannel.GetString('title')); Memo1.Lines.Add('Link: ' + rssChannel.GetString('link')); Memo1.Lines.Add('Description: ' + rssChannel.GetString('description')); // For each item in the channel, display the title, link, // publish date, and categories assigned to the post. numItems := rssChannel.NumItems; for i := 0 to numItems - 1 do begin rssItem := rssChannel.GetItem(i); Memo1.Lines.Add('----'); Memo1.Lines.Add('Title: ' + rssItem.GetString('title')); Memo1.Lines.Add('Link: ' + rssItem.GetString('link')); Memo1.Lines.Add('pubDate: ' + rssItem.GetString('pubDate')); numCategories := rssItem.GetCount('category'); if (numCategories > 0) then begin for j := 0 to numCategories - 1 do begin Memo1.Lines.Add(' category: ' + rssItem.MGetString('category',j)); end; end; end; end; |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.