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

推荐订阅源

S
SegmentFault 最新的问题
Security Latest
Security Latest
Martin Fowler
Martin Fowler
酷 壳 – CoolShell
酷 壳 – CoolShell
Engineering at Meta
Engineering at Meta
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
罗磊的独立博客
MyScale Blog
MyScale Blog
Microsoft Azure Blog
Microsoft Azure Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
博客园 - 叶小钗
H
Help Net Security
大猫的无限游戏
大猫的无限游戏
U
Unit 42
G
Google Developers Blog
V
Visual Studio Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
PCI Perspectives
PCI Perspectives
The Last Watchdog
The Last Watchdog
有赞技术团队
有赞技术团队
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Application and Cybersecurity Blog
Application and Cybersecurity Blog
雷峰网
雷峰网
SecWiki News
SecWiki News
Google Online Security Blog
Google Online Security Blog
S
Security @ Cisco Blogs
N
News | PayPal Newsroom
The Hacker News
The Hacker News
月光博客
月光博客
T
Threatpost
B
Blog
P
Proofpoint News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Simon Willison's Weblog
Simon Willison's Weblog
P
Palo Alto Networks Blog
L
LangChain Blog
Scott Helme
Scott Helme
Last Week in AI
Last Week in AI
C
Check Point Blog
P
Privacy International News Feed

博客园 - 冷火

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);
}