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
(Objective-C) Read RSS FeedSample code showing how to read an RSS feed and emit the contents.
#import <CkoRss.h> CkoRss *rss = [[CkoRss alloc] init]; // Download from the feed URL: BOOL success = [rss DownloadRss: @"http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"]; if (success != YES) { NSLog(@"%@",rss.LastErrorText); return; } // Get the 1st channel. CkoRss *rssChannel = [rss GetChannel: [NSNumber numberWithInt: 0]]; if (rss.LastMethodSuccess == NO) { NSLog(@"%@",@"No channel found in RSS feed."); return; } // Display the various pieces of information about the channel: NSLog(@"%@%@",@"Title: ",[rssChannel GetString: @"title"]); NSLog(@"%@%@",@"Link: ",[rssChannel GetString: @"link"]); NSLog(@"%@%@",@"Description: ",[rssChannel GetString: @"description"]); // For each item in the channel, display the title, link, // publish date, and categories assigned to the post. int numItems = [rssChannel.NumItems intValue]; int i; for (i = 0; i <= numItems - 1; i++) { CkoRss *rssItem = [rssChannel GetItem: [NSNumber numberWithInt: i]]; NSLog(@"%@",@"----"); NSLog(@"%@%@",@"Title: ",[rssItem GetString: @"title"]); NSLog(@"%@%@",@"Link: ",[rssItem GetString: @"link"]); NSLog(@"%@%@",@"pubDate: ",[rssItem GetString: @"pubDate"]); int numCategories = [[rssItem GetCount: @"category"] intValue]; int j; if (numCategories > 0) { for (j = 0; j <= numCategories - 1; j++) { NSLog(@"%@%@",@" category: ",[rssItem MGetString: @"category" index: [NSNumber numberWithInt: j]]); } } } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.