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
(DataFlex) Read RSS FeedSample code showing how to read an RSS feed and emit the contents.
Use ChilkatAx-win32.pkg Procedure Test Handle hoRss Boolean iSuccess Variant vRssChannel Handle hoRssChannel Integer iNumItems Integer i Variant vRssItem Handle hoRssItem Integer iNumCategories Integer j String sTemp1 Boolean bTemp1 Get Create (RefClass(cComChilkatRss)) To hoRss If (Not(IsComObjectCreated(hoRss))) Begin Send CreateComObject of hoRss End // Download from the feed URL: Get ComDownloadRss Of hoRss "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml" To iSuccess If (iSuccess <> True) Begin Get ComLastErrorText Of hoRss To sTemp1 Showln sTemp1 Procedure_Return End // Get the 1st channel. Get ComGetChannel Of hoRss 0 To vRssChannel If (IsComObject(vRssChannel)) Begin Get Create (RefClass(cComChilkatRss)) To hoRssChannel Set pvComObject Of hoRssChannel To vRssChannel End Get ComLastMethodSuccess Of hoRss To bTemp1 If (bTemp1 = False) Begin Showln "No channel found in RSS feed." Procedure_Return End // Display the various pieces of information about the channel: Get ComGetString Of hoRssChannel "title" To sTemp1 Showln "Title: " sTemp1 Get ComGetString Of hoRssChannel "link" To sTemp1 Showln "Link: " sTemp1 Get ComGetString Of hoRssChannel "description" To sTemp1 Showln "Description: " sTemp1 // For each item in the channel, display the title, link, // publish date, and categories assigned to the post. Get ComNumItems Of hoRssChannel To iNumItems For i From 0 To (iNumItems - 1) Get ComGetItem Of hoRssChannel i To vRssItem If (IsComObject(vRssItem)) Begin Get Create (RefClass(cComChilkatRss)) To hoRssItem Set pvComObject Of hoRssItem To vRssItem End Showln "----" Get ComGetString Of hoRssItem "title" To sTemp1 Showln "Title: " sTemp1 Get ComGetString Of hoRssItem "link" To sTemp1 Showln "Link: " sTemp1 Get ComGetString Of hoRssItem "pubDate" To sTemp1 Showln "pubDate: " sTemp1 Get ComGetCount Of hoRssItem "category" To iNumCategories If (iNumCategories > 0) Begin For j From 0 To (iNumCategories - 1) Get ComMGetString Of hoRssItem "category" j To sTemp1 Showln " category: " sTemp1 Loop End Send Destroy of hoRssItem Loop Send Destroy of hoRssChannel End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.