Togezor With U

It's a good idea to play with UI-Technology, such as Ajax, Silverlight...

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

C#中解析Rss实现思路及通用类”应用的实例:

string strHtml = "";
string url = "http://rss.xinhuanet.com/rss/native.xml";

Utility.Rss.Feed feed 
= new Utility.Rss.Feed(url,DateTime.Parse(System.DateTime.Now.AddDays(-1).ToShortDateString()));
                    feed.Read();
                    strHtml 
+= "[记录数目:"+feed.Channel.Items.Count+"]<br><br>";
                    
for(int i=0;i<feed.Channel.Items.Count;i++)
                    
{
//                        arr = feed.Channel.Items[i].title.Split(cSplit);
                        strHtml +="  <a href="+feed.Channel.Items[i].link+" target=_blank><B>"+ feed.Channel.Items[i].title + "</B></a><br>";
                        strHtml 
+="  <font color=red>"+feed.Channel.Items[i].pubDate + "</font><br>";
                        strHtml 
+="  "+feed.Channel.Items[i].description + "<br>";
                    }



Response.Write(strHtml);
posted on 2008-07-26 21:33  togezor  阅读(278)  评论(0)    收藏  举报