惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recorded Future
Recorded Future
C
Cyber Attacks, Cyber Crime and Cyber Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Scott Helme
Scott Helme
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Palo Alto Networks Blog
Google Online Security Blog
Google Online Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
WordPress大学
WordPress大学
博客园 - 聂微东
L
LINUX DO - 最新话题
月光博客
月光博客
小众软件
小众软件
T
Troy Hunt's Blog
A
Arctic Wolf
量子位
I
Intezer
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
S
Schneier on Security
Schneier on Security
Schneier on Security
NISL@THU
NISL@THU
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
有赞技术团队
有赞技术团队
N
News and Events Feed by Topic
美团技术团队
The Cloudflare Blog
P
Privacy International News Feed
S
Security Affairs
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
GRAHAM CLULEY
N
News | PayPal Newsroom
Apple Machine Learning Research
Apple Machine Learning Research
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LINUX DO - 热门话题
V
Vulnerabilities – Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
Application and Cybersecurity Blog
Application and Cybersecurity Blog
IT之家
IT之家
Hacker News: Ask HN
Hacker News: Ask HN
雷峰网
雷峰网

博客园 - 冷火

Lucene.Net学习 Confirm GridView Deletes with the ModalPopupExtender 如何在C#中实现图片缩放 [ASP.NET] 限制上传文件类型的两种方法 asp.net采集 在C#怎用一条正则表达式验证用逗号隔开的email地址 关于LumiSoft.Net.POP3.Client接收邮件例子(包括附件) dhtmlXTreeprofessional asp.net导出xml文件 - 冷火 - 博客园 DateDiff Datagridview下一行下一行 GridView控件修改、删除示例(修改含有DropDownList控件) - 冷火 - 博客园 局域网QQ第三版(V1.4) asp.net+JSON+AJAX(基于prototype1.4)做无刷新的2级DropDownList - 冷火 - 博客园 非常好的菜单效果(Accordion风格) 静功解决失眠的问题 ASP.NET中文验证码详解 log4net Config Examples 对XAML进行编辑的辅助类(XamlHelper)
Argotic Syndication Framework生成RSS - 冷火
冷火 · 2010-04-02 · via 博客园 - 冷火
using System.IO;
using Argotic.Syndication;

RssFeed feed = new RssFeed();

feed.Channel.Link = new Uri("http://localhost");
feed.Channel.Title = "Simple RSS Feed";
feed.Channel.Description = "A minimal RSS 2.0 syndication feed.";

RssItem item = new RssItem();
item.Title = "Simple RSS Item";
item.Link = new Uri("http://localhost/items/SimpleRSSItem.aspx");
item.Description = "A minimal RSS channel item.";

feed.Channel.AddItem(item);

using(FileStream stream = new FileStream("SimpleRssFeed.xml", FileMode.Create, FileAccess.Write))
{
feed.Save(stream);
}
例子2:

using System.IO;
using Argotic.Common;
using Argotic.Syndication;

RssFeed feed = new RssFeed();

feed.Channel.Link = new Uri("http://localhost");
feed.Channel.Title = "Compact RSS Feed";
feed.Channel.Description = "A minimal and non-indented RSS 2.0 syndication feed.";

RssItem item = new RssItem();
item.Title = "Simple RSS Item";
item.Link = new Uri("http://localhost/items/SimpleRSSItem.aspx");
item.Description = "A minimal RSS channel item.";

feed.Channel.AddItem(item);

using (FileStream stream = new FileStream("CompactRssFeed.xml", FileMode.Create, FileAccess.Write))
{
SyndicationResourceSaveSettings settings = new SyndicationResourceSaveSettings();
settings.MinimizeOutputSize = true;

feed.Save(stream, settings);
}


如果在当前页输出可以用如下代码:

      Response.ContentType = "application/rss+xml";
        SyndicationResourceSaveSettings settings = new SyndicationResourceSaveSettings();
        settings.CharacterEncoding = new UTF8Encoding(false);
        feed.Save(Response.OutputStream, settings); 

 读取的例子:

using Argotic.Extensions.Core;
using Argotic.Syndication;

RssFeed feed = new RssFeed(new Uri("http://example.com/feed.aspx"), "Simple extended syndication feed");
feed.Channel.Description = "An example of how to generate an extended syndication feed.";

// Create and add iTunes information to feed channel
ITunesSyndicationExtension channelExtension = new ITunesSyndicationExtension();
channelExtension.Context.Subtitle = "This feed uses the iTunes syndication extension.";
channelExtension.Context.ExplicitMaterial = ITunesExplicitMaterial.No;
channelExtension.Context.Author = "John Doe";
channelExtension.Context.Summary = "The Argotic syndication framework natively supports the iTunes syndication extension.";
channelExtension.Context.Owner = new ITunesOwner("john.doe@example.com", "John Q. Doe");
channelExtension.Context.Image = new Uri("http://example.com.feed_logo.jpg");

channelExtension.Context.Categories.Add(new ITunesCategory("Extensions"));
channelExtension.Context.Categories.Add(new ITunesCategory("iTunes"));

feed.Channel.AddExtension(channelExtension);

// Create and add iTunes information to channel item
RssItem item = new RssItem();
item.Title = "My Extended Channel Item";
item.Link = new Uri("http://example.com/posts/1234");
item.PublicationDate = DateTime.Now;

RssEnclosure enclosure = new RssEnclosure(47156978L, "audio/mp3", new Uri("http://example.com/myPodcast.mp3"));
item.Enclosures.Add(enclosure);

ITunesSyndicationExtension itemExtension = new ITunesSyndicationExtension();
itemExtension.Context.Author = "Jane Doe";
itemExtension.Context.Subtitle = "This channel item uses the iTunes syndication extension.";
itemExtension.Context.Summary = "The iTunes syndication extension properties that are used vary based on whether extending the channel or an item";
itemExtension.Context.Duration = new TimeSpan(1, 2, 13);
itemExtension.Context.Keywords.Add("Podcast");
itemExtension.Context.Keywords.Add("iTunes");

item.AddExtension(itemExtension);

feed.Channel.AddItem(item);

// Persist extended feed
using (FileStream stream = new FileStream("ExtendedFeed.rss.xml", FileMode.Create, FileAccess.Write))
{
feed.Save(stream);
}