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
(C++) Read RSS FeedSample code showing how to read an RSS feed and emit the contents.
#include <CkRss.h> void ChilkatSample(void) { CkRss rss; // Download from the feed URL: bool success = rss.DownloadRss("http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"); if (success != true) { std::cout << rss.lastErrorText() << "\r\n"; return; } // Get the 1st channel. CkRss *rssChannel = rss.GetChannel(0); if (rss.get_LastMethodSuccess() == false) { std::cout << "No channel found in RSS feed." << "\r\n"; return; } // Display the various pieces of information about the channel: std::cout << "Title: " << rssChannel->getString("title") << "\r\n"; std::cout << "Link: " << rssChannel->getString("link") << "\r\n"; std::cout << "Description: " << rssChannel->getString("description") << "\r\n"; // For each item in the channel, display the title, link, // publish date, and categories assigned to the post. int numItems = rssChannel->get_NumItems(); int i; for (i = 0; i <= numItems - 1; i++) { CkRss *rssItem = rssChannel->GetItem(i); std::cout << "----" << "\r\n"; std::cout << "Title: " << rssItem->getString("title") << "\r\n"; std::cout << "Link: " << rssItem->getString("link") << "\r\n"; std::cout << "pubDate: " << rssItem->getString("pubDate") << "\r\n"; int numCategories = rssItem->GetCount("category"); int j; if (numCategories > 0) { for (j = 0; j <= numCategories - 1; j++) { std::cout << " category: " << rssItem->mGetString("category",j) << "\r\n"; } } delete rssItem; } delete rssChannel; } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.