程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> 關於C語言 >> C#獲取RSS全文

C#獲取RSS全文

編輯:關於C語言
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Microsoft.Feeds.Interop;
namespace RssFeedReader
{
  class ReadRssFeed
  {
    static void Main(string[] args)
    {
       FeedsManagerClass fm = new FeedsManagerClass();
       string url = @"http://www.nordpoolspot.com/alerts/umm_feed"; //URL
       IFeedFolder rootFolder = (IFeedFolder)fm.RootFolder;
       IFeed feed = null;
       if (!fm.IsSubscribed(url))
       {
          feed = (IFeed)rootFolder.CreateFeed(url, url);
          feed.Rename("Nord Pool Spot UMM");
       }
       else
       {
          feed = (IFeed)fm.GetFeed(@"Nord Pool Spot UMM");
       }
       feed.Download();
       IFeedItem tt = feed.GetItem(0) as IFeedItem;
       string title = tt.Title;
       string xml = feed.XML(feed.ItemCount,
          FEEDS_XML_SORT_PROPERTY.FXSP_PUBDATE,
          FEEDS_XML_SORT_ORDER.FXSO_ASCENDING,
          FEEDS_XML_FILTER_FLAGS.FXFF_ALL,
          FEEDS_XML_INCLUDE_FLAGS.FXIF_CF_EXTENSIONS);
       StreamWriter sw = new StreamWriter(File.OpenWrite("test.XML"));
       sw.Write(XML);
       sw.Close();
    }
  }
}
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved