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
(Go) Read RSS FeedSample code showing how to read an RSS feed and emit the contents.
rss := chilkat.NewRss() // Download from the feed URL: success := rss.DownloadRss("http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml") if success != true { fmt.Println(rss.LastErrorText()) rss.DisposeRss() return } // Get the 1st channel. rssChannel := rss.GetChannel(0) if rss.LastMethodSuccess() == false { fmt.Println("No channel found in RSS feed.") rss.DisposeRss() return } // Display the various pieces of information about the channel: fmt.Println("Title: ", *rssChannel.GetString("title")) fmt.Println("Link: ", *rssChannel.GetString("link")) fmt.Println("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() var i int for i = 0; i <= numItems - 1; i++ { rssItem := rssChannel.GetItem(i) fmt.Println("----") fmt.Println("Title: ", *rssItem.GetString("title")) fmt.Println("Link: ", *rssItem.GetString("link")) fmt.Println("pubDate: ", *rssItem.GetString("pubDate")) numCategories := rssItem.GetCount("category") var j int if numCategories > 0 { for j = 0; j <= numCategories - 1; j++ { fmt.Println(" category: ", *rssItem.MGetString("category",j)) } } rssItem.DisposeRss() } rssChannel.DisposeRss() rss.DisposeRss() |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.