Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Read RSS Feed Reader XML System.ServiceModel.Web System.Xml System.Xml.XmlReader System.ServiceModel.Syndication.Rss20FeedFormatter ReadFrom Rss20FeedFormatter SyndicationFeed SyndicationItem
;*************************************************************************** ;** RSS Feed Reader ;** ;** Purpose: Read an RSS feed using dotNet. Displays full summary of the selected Rss Feed in a message ;** Inputs: URL of RSS feed ;** Outputs: Results in a Reportview / Message ;** Reference: ;** REQUIRES WinBatch 2013A or newer and dotNet 2.0 or newer. ;** ;** Developer: Deana Falk 2013.06.13 ;*************************************************************************** If Version( )< '2013A' Pause('Notice', 'Need 2013A or Newer Version of WinBatch') Exit EndIf ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; Prompt for input ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ rssfeed = 'http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml' maxfeed = 128 ; Maximum nuber of syndication items to display ; Create an array to store the results arrRssFeed = ArrDimension(maxfeed,2) ;Columns: Title,Summary arrRssFeed[0,0] = 'Title' arrRssFeed[0,1] = 'Summary' ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; Load assemblies into the WinBatch process. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;ObjectClrOption( 'use', 'System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35');System.ServiceModel.Web v4.0_4.0.0.0__31bf3856ad364e35 ;ObjectClrOption( 'use', 'System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35');System.ServiceModel.Web v3.5.0.0__31bf3856ad364e35 ObjectClrOption( 'use', 'System.ServiceModel.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35');System.ServiceModel.Web v2.0.0.0__31bf3856ad364e35 ObjectClrOption( 'use', 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; Create a class implemented by a managed assembly. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;Create an instance of XmlReader class that reads XML data from a specified URL. XmlReader = ObjectClrNew( 'System.Xml.XmlReader' ) XmlReader = XmlReader.Create( rssfeed ) ; Create an instance of Rss20FeedFormatter class. Rss20FeedFormatter = ObjectClrNew( 'System.ServiceModel.Syndication.Rss20FeedFormatter' ) ; The ReadFrom() method of Rss20FeedFormatter class accepts an XmlReader and reads the XML data. Rss20FeedFormatter.ReadFrom(XmlReader) ; The XmlReader is closed. XmlReader.Close() ; The Feed property of Rss20FeedFormatter class is of type SyndicationFeed and represents the feed being read. ; The Title and Copyright properties of SyndicationFeed class return title and copyright mesage of the current feed respectively. Title = Rss20FeedFormatter.Feed.Title.Text Title = Title : ' [ ' : Rss20FeedFormatter.Feed.Copyright.Text : ' ]' ; The Items property of the SyndicationFeed class returns a collection of SyndicationItem objects representing feed items. SyndicationItems = Rss20FeedFormatter.Feed.Items row = 1 ForEach Item in SyndicationItems arrRssFeed[row,0] = Item.Title.Text ; Title arrRssFeed[row,1] = StrSub( Item.Summary.Text, 1, 2048 ) ; Summary row = row + 1 Next MyDialogFormat=`WWWDLGED,6.2` MyDialogCaption=`RSS Feed Reader Sample` MyDialogX=002 MyDialogY=059 MyDialogWidth=766 MyDialogHeight=353 MyDialogNumControls=005 MyDialogProcedure=`DEFAULT` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialogConfig=0 MyDialog001=`257,331,122,012,PUSHBUTTON,"PushButton_Display",DEFAULT,"Display Feed Summary",1,10,32,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`391,331,070,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog003=`015,033,736,290,REPORTVIEW,"ReportView_1",arrRssFeed,DEFAULT,DEFAULT,30,11534336,DEFAULT,DEFAULT,"192|192|192"` MyDialog004=`015,003,526,012,VARYTEXT,"FeedTitle_1",Title,DEFAULT,DEFAULT,40,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog005=`015,023,300,008,STATICTEXT,"StaticText_1",DEFAULT,"Select the feed item you would like to display.",DEFAULT,60,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("MyDialog") ;Display Full Summary of the selected Rss Feed in a message feedtitle = arrRssFeed[0,0] feedsummary = arrRssFeed[0,1] Pause( feedtitle, feedsummary ) Exit
Article ID: W17841
Filename: Read RSS Feed.txt
File Created: 2013:06:14:08:52:32
Last Updated: 2013:06:14:08:52:32