Hashemian Blog

Web Tools, Financial Markets, Technology

Sunday, June 29, 2008

RSS/ATOM SyndicationFeed in .NET 3.5 Framework 

RSS/ATOM FeedAmong some of the new classes introduced in Version 3.5 of the .NET Framework Class Library (FCL) were the syndication-related classes. While other technologies such as LINQ, extension methods and lambda expressions have been grabbing most of the attention the new syndication classes also deserve a nod. Part of the System.ServiceModel.Syndication namespace the classes offer a variety of methods to easily generate or consume syndication feeds in RSS 2.0 or ATOM 1.0 formats.

It's not that reading or writing feeds were exceedingly difficult before. FCL comes with a number of XML classes that facilitate working with XML data which all syndication feeds emanate from. No doubt there are plenty of sample code out there that made the task as easy as copy, paste and tweak. But now FCL comes with its own native classes to handle feeds, with advanced settings, intellisense, and potential of extension.

To demonstrate ease of use, here's a sample code that pulls in a sample feed from Google, and scrapes and saves the content of each link to a file:
var wc = new WebClient();
using (var rss = XmlReader.Create(
"http://finance.google.com/finance?morenews=10&q=NASDAQ:INTC&output=rss")) {
var feed = SyndicationFeed.Load(rss);
foreach (var x in feed.Items) {
var uri = x.Links.Last().Uri;
wc.DownloadFile(uri, @"c:\rss\" + Regex.Replace(uri.LocalPath, @"^.*/", ""));
}
}

That was easy, eh? Just remember to add System.ServiceModel.Web.dll as a reference to your project. Happy syndicating.

,,,,,

Labels:

<RSS/ATOM SyndicationFeed in .NET 3.5 Framework>

0 comments

0 Comments:

Post a Comment

This page is powered by Blogger. Isn't yours?

Links
  • Hashemian Blog Feeds
  • Add to Google
  • Read Hashemian.com/blog/ with Bloglines
  • Subscribe to Hashemian.com/blog/ with My Yahoo!
  • Technorati Profile
  • TMCnet.com
  • ARCHIVES
  • 09/01/2003 - 10/01/2003
  • 03/01/2004 - 04/01/2004
  • 04/01/2004 - 05/01/2004
  • 05/01/2004 - 06/01/2004
  • 06/01/2004 - 07/01/2004
  • 07/01/2004 - 08/01/2004
  • 08/01/2004 - 09/01/2004
  • 09/01/2004 - 10/01/2004
  • 10/01/2004 - 11/01/2004
  • 11/01/2004 - 12/01/2004
  • 12/01/2004 - 01/01/2005
  • 01/01/2005 - 02/01/2005
  • 02/01/2005 - 03/01/2005
  • 03/01/2005 - 04/01/2005
  • 04/01/2005 - 05/01/2005
  • 05/01/2005 - 06/01/2005
  • 06/01/2005 - 07/01/2005
  • 07/01/2005 - 08/01/2005
  • 08/01/2005 - 09/01/2005
  • 09/01/2005 - 10/01/2005
  • 10/01/2005 - 11/01/2005
  • 11/01/2005 - 12/01/2005
  • 12/01/2005 - 01/01/2006
  • 01/01/2006 - 02/01/2006
  • 02/01/2006 - 03/01/2006
  • 03/01/2006 - 04/01/2006
  • 04/01/2006 - 05/01/2006
  • 05/01/2006 - 06/01/2006
  • 06/01/2006 - 07/01/2006
  • 07/01/2006 - 08/01/2006
  • 08/01/2006 - 09/01/2006
  • 09/01/2006 - 10/01/2006
  • 10/01/2006 - 11/01/2006
  • 11/01/2006 - 12/01/2006
  • 12/01/2006 - 01/01/2007
  • 01/01/2007 - 02/01/2007
  • 02/01/2007 - 03/01/2007
  • 03/01/2007 - 04/01/2007
  • 04/01/2007 - 05/01/2007
  • 05/01/2007 - 06/01/2007
  • 06/01/2007 - 07/01/2007
  • 07/01/2007 - 08/01/2007
  • 08/01/2007 - 09/01/2007
  • 09/01/2007 - 10/01/2007
  • 10/01/2007 - 11/01/2007
  • 11/01/2007 - 12/01/2007
  • 12/01/2007 - 01/01/2008
  • 01/01/2008 - 02/01/2008
  • 02/01/2008 - 03/01/2008
  • 03/01/2008 - 04/01/2008
  • 04/01/2008 - 05/01/2008
  • 05/01/2008 - 06/01/2008
  • 06/01/2008 - 07/01/2008
  • 07/01/2008 - 08/01/2008
  • 08/01/2008 - 09/01/2008

  • Read Financial Markets  |   Home  |   Blog  |   Web Tools  |   News  |   Articles  |   FAQ  |   About  |   Contact

    © 2001-2009 Robert Vahid Hashemian
    Support the effort
    Liked this page?
    Please consider creating a link to it
    from your Web site.

    hashemian.com
    هاشمیان.com

     Home

     Blog

     Web Tools Add Free Web Tools custom Google Toolbar button (Requires Toolbar >V4)
    Usage

     News

     Articles

     FAQ

     About

     Contact

     Financial Markets Book
    Read Complete Book



    BOOK
    Pro Silverlight 3 in C#
    Matthew MacDonald
    $49.99


    BOOK
    MCTS Self-Paced Training Kit (Exam 70-536): Microsoft® .NET Framework Application Development Foundation, Second edition
    Tony Northrup
    $69.99


    BOOK
    Pro ASP.NET MVC Framework
    Steven Sanderson
    $49.99


    BOOK
    Microsoft® .NET: Architecting Applications for the Enterprise (PRO-Developer)
    Andrea Saltarello
    $44.99


    BOOK
    Pro C# 2008 and the .NET 3.5 Platform, Fourth Edition (Windows.Net)
    Andrew Troelsen
    $59.99

    |rssatom-syndicationfeed-in-net|

    more…




    Get Kindle, $259

    aStore - Hashemian.com on Amazon

    Visits: Powered by hashemian.com

     

     

     

     

     

    Search Hashemian.com





    (823) The Last Label of the Conti in Munich (Germany)
    $2.00
    Ends: Wed Nov 25, 2009 05:23:21 EST


    Fiat wheel cover hub in good condition.
    $9.12
    Ends: Wed Nov 25, 2009 05:23:25 EST


    Barbie City Seasons Winter in New York (NRFB)
    $26.41
    Ends: Wed Nov 25, 2009 05:23:55 EST


    Spawn Alien Spawn in package
    $2.50
    Ends: Wed Nov 25, 2009 05:24:01 EST


    Blue Elf (Version 2) 309 games in 1 - Jamma
    $0.99
    Ends: Wed Nov 25, 2009 05:24:07 EST

    more…