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
(Unicode C) Read RSS FeedSample code showing how to read an RSS feed and emit the contents.
#include <C_CkRssW.h> void ChilkatSample(void) { HCkRssW rss; BOOL success; HCkRssW rssChannel; int numItems; int i; HCkRssW rssItem; int numCategories; int j; rss = CkRssW_Create(); // Download from the feed URL: success = CkRssW_DownloadRss(rss,L"http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"); if (success != TRUE) { wprintf(L"%s\n",CkRssW_lastErrorText(rss)); CkRssW_Dispose(rss); return; } // Get the 1st channel. rssChannel = CkRssW_GetChannel(rss,0); if (CkRssW_getLastMethodSuccess(rss) == FALSE) { wprintf(L"No channel found in RSS feed.\n"); CkRssW_Dispose(rss); return; } // Display the various pieces of information about the channel: wprintf(L"Title: %s\n",CkRssW_getString(rssChannel,L"title")); wprintf(L"Link: %s\n",CkRssW_getString(rssChannel,L"link")); wprintf(L"Description: %s\n",CkRssW_getString(rssChannel,L"description")); // For each item in the channel, display the title, link, // publish date, and categories assigned to the post. numItems = CkRssW_getNumItems(rssChannel); for (i = 0; i <= numItems - 1; i++) { rssItem = CkRssW_GetItem(rssChannel,i); wprintf(L"----\n"); wprintf(L"Title: %s\n",CkRssW_getString(rssItem,L"title")); wprintf(L"Link: %s\n",CkRssW_getString(rssItem,L"link")); wprintf(L"pubDate: %s\n",CkRssW_getString(rssItem,L"pubDate")); numCategories = CkRssW_GetCount(rssItem,L"category"); if (numCategories > 0) { for (j = 0; j <= numCategories - 1; j++) { wprintf(L" category: %s\n",CkRssW_mGetString(rssItem,L"category",j)); } } CkRssW_Dispose(rssItem); } CkRssW_Dispose(rssChannel); CkRssW_Dispose(rss); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.