本文整理汇总了C#中System.ServiceModel.Syndication.Atom10FeedFormatter类的典型用法代码示例。如果您正苦于以下问题:C# Atom10FeedFormatter类的具体用法?C# Atom10FeedFormatter怎么用?C# Atom10FeedFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Atom10FeedFormatter类属于System.ServiceModel.Syndication命名空间,在下文中一共展示了Atom10FeedFormatter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateFeed
public SyndicationFeedFormatter CreateFeed()
{
// Create a new Syndication Feed.
SyndicationFeed feed = new SyndicationFeed("Feed Title", "A WCF Syndication Feed", null);
List<SyndicationItem> items = new List<SyndicationItem>();
// Create a new Syndication Item.
SyndicationItem item = new SyndicationItem("An item", "Item content", null);
items.Add(item);
feed.Items = items;
// Return ATOM or RSS based on query string
// rss -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceLibrary1/Feed1/
// atom -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceLibrary1/Feed1/?format=atom
string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
SyndicationFeedFormatter formatter = null;
if (query == "atom")
{
formatter = new Atom10FeedFormatter(feed);
}
else
{
formatter = new Rss20FeedFormatter(feed);
}
return formatter;
}
开发者ID:hkuntal,项目名称:MySociety,代码行数:27,代码来源:Feed1.cs
示例2: Atom10ItemFormatter
public Atom10ItemFormatter(SyndicationItem itemToWrite) : base(itemToWrite)
{
this.feedSerializer = new Atom10FeedFormatter();
this.feedSerializer.PreserveAttributeExtensions = this.preserveAttributeExtensions = true;
this.feedSerializer.PreserveElementExtensions = this.preserveElementExtensions = true;
this.itemType = itemToWrite.GetType();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:Atom10ItemFormatter.cs
示例3: ExecuteResult
public override void ExecuteResult(ControllerContext context)
{
context.HttpContext.Response.ContentType = "application/atom+xml";
var formatter = new Atom10FeedFormatter(Feed);
using (XmlWriter writer = XmlWriter.Create(context.HttpContext.Response.Output))
formatter.WriteTo(writer);
}
开发者ID:lg31415,项目名称:Graphite,代码行数:7,代码来源:RssResult.cs
示例4: ExecuteResult
public override void ExecuteResult(ControllerContext context)
{
context.HttpContext.Response.ContentType = "application/atom+xml";
//check request is for Atom or RSS
if (context.HttpContext.Request.QueryString["type"] != null && context.HttpContext.Request.QueryString["type"].ToString().ToLower() == "atom")
{
//Atom Feed
context.HttpContext.Response.ContentType = "application/atom+xml";
var rssFormatter = new Atom10FeedFormatter(FeedData);
using (XmlWriter writer = XmlWriter.Create(context.HttpContext.Response.Output, new XmlWriterSettings { Indent = true }))
{
rssFormatter.WriteTo(writer);
}
}
else
{
//RSS Feed
context.HttpContext.Response.ContentType = "application/rss+xml";
var rssFormatter = new Rss20FeedFormatter(FeedData);
using (XmlWriter writer = XmlWriter.Create(context.HttpContext.Response.Output, new XmlWriterSettings { Indent = true }))
{
rssFormatter.WriteTo(writer);
}
}
}
开发者ID:smashmirrorcardboardface,项目名称:Azure-ServiceBus-Testing,代码行数:26,代码来源:FeedResult.cs
示例5: Build
public FeedData Build(string data, string url)
{
var formatter = new Atom10FeedFormatter();
using (var reader = new StringReader(data))
{
using (var xmlReader = XmlReader.Create(reader))
{
formatter.ReadFrom(xmlReader);
var feed = formatter.Feed;
return new FeedData
{
Id = Guid.Parse(feed.Id),
DateCreated = feed.LastUpdatedTime.UtcDateTime,
PreviousUri = GetUriFromLink(PrevInArchiveRelationshipType, feed),
NextUri = GetUriFromLink(NextInArchiveRelationshipType, feed),
Messages = feed.Items.Select(x =>
{
return new Message
{
Body = GetXmlString(x),
CreatedAt = x.LastUpdatedTime.UtcDateTime,
Id = Guid.Parse(x.Id),
FeedUri = url
};
}).ToArray()
};
}
}
}
开发者ID:peterbeams,项目名称:SimpleAtomPubSub,代码行数:29,代码来源:AtomFormatter.cs
示例6: FbItems
public List<BannerItem> FbItems()
{
Atom10FeedFormatter formatter = new Atom10FeedFormatter();
using (XmlReader reader = XmlReader.Create(ConfigurationManager.AppSettings["FacebookFeed"]))
{
formatter.ReadFrom(reader);
}
var bannerItems = new List<BannerItem>();
foreach (var e in formatter.Feed.Items)
{
if (!e.Title.Text.StartsWith("Wallflux"))
{
BannerItem le = new BannerItem();
le.title = e.Title.Text;
le.content = new entryContent
{
Value = ((TextSyndicationContent)e.Content).Text
};
le.link = new entryLink
{
href = e.Id,
target = "_blank"
};
le.updated = e.LastUpdatedTime.DateTime.ToShortDateString();
le.published = "Published on facebook "+e.PublishDate.DateTime.ToShortDateString();
le.TypeOfContent = Enum.GetName(typeof(TypeOfContent), TypeOfContent.FacebookPost);
bannerItems.Add(le);
}
}
return bannerItems;
/* sparas, extrahera bilder
List<RssFeedItem> rssItems = new List<RssFeedItem>();
Stream stream = e.Result;
XmlReader response = XmlReader.Create(stream);
SyndicationFeed feeds = SyndicationFeed.Load(response);
foreach (SyndicationItem f in feeds.Items)
{
RssFeedItem rssItem = new RssFeedItem();
rssItem.Description = f.Summary.Text;
const string rx = @"(?<=img\s+src\=[\x27\x22])(?<Url>[^\x27\x22]*)(?=[\x27\x22])";
foreach (Match m in Regex.Matches(f.Summary.Text, rx, RegexOptions.IgnoreCase | RegexOptions.Multiline))
{
string src = m.Groups[1].Value;
if (src.StartsWith("//")) // Google RSS has it
{
src = src.Replace("//", "http://");
}
rssItem.ImageLinks.Add(src);
}
*/
}
开发者ID:Aikidokan,项目名称:www_marcbachraty_com,代码行数:60,代码来源:FeedReader.cs
示例7: GetFeeds
public static IList<Feed> GetFeeds()
{
var urls = new[]
{
"http://www.simplyvinay.com/GetBlogRss.aspx", "http://www.bbc.co.uk/blogs/formula1/rss.xml",
"http://feeds.feedburner.com/AyendeRahien"
};
var list = new List<Feed>();
foreach (var url in urls)
{
using (var reader = new CustomXmlReader(url))
{
if (reader.ReadState == ReadState.Initial)
reader.MoveToContent();
var atom = new Atom10FeedFormatter();
if (atom.CanRead(reader))
{
atom.ReadFrom(reader);
list.AddRange(GenerateFeed(atom.Feed, true));
}
var rss = new Rss20FeedFormatter();
if (rss.CanRead(reader))
{
rss.ReadFrom(reader);
list.AddRange(GenerateFeed(rss.Feed, false));
}
}
}
return list;
}
开发者ID:simplyvinay,项目名称:feedreader,代码行数:33,代码来源:Program.cs
示例8: ExecuteResult
public override void ExecuteResult(ControllerContext context)
{
SyndicationFeedFormatter formatter;
string contentType;
switch (_feedType)
{
case FeedType.Atom:
formatter = new Atom10FeedFormatter(_syndicationFeed);
contentType = "application/atom+xml";
break;
case FeedType.Rss:
formatter = new Rss20FeedFormatter(_syndicationFeed);
contentType = "application/rss+xml";
break;
default:
throw new NotImplementedException("Feed type not accounted for");
}
context.HttpContext.Response.ContentType = contentType;
using (var writer = XmlWriter.Create(context.HttpContext.Response.Output))
{
formatter.WriteTo(writer);
}
}
开发者ID:harpreet,项目名称:TinyBlog,代码行数:26,代码来源:FeedController.cs
示例9: CreateFeed
public SyndicationFeedFormatter CreateFeed()
{
// Créez un flux RSS.
SyndicationFeed feed = new SyndicationFeed("Bug Track", "Flux rss du bug track", null);
List<SyndicationItem> items = new List<SyndicationItem>();
// Créez un article RSS.
List<DBO.Bug> bugs = DataAccess.Bug.GetLastBug(10);
bugs.ForEach(bug => items.Add(new SyndicationItem(bug.Title, bug.Details, null)));
feed.Items = items;
// Renvoie ATOM ou RSS en fonction de la chaîne de requête
// rss -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceBugTrack/Feed1/
// atom -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceBugTrack/Feed1/?format=atom
string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
SyndicationFeedFormatter formatter = null;
if (query == "atom")
{
formatter = new Atom10FeedFormatter(feed);
}
else
{
formatter = new Rss20FeedFormatter(feed);
}
return formatter;
}
开发者ID:ThomasCOLLIN,项目名称:TPs,代码行数:28,代码来源:Feed1.cs
示例10: CreateFeed
public SyndicationFeedFormatter CreateFeed()
{
// Créez un flux RSS.
SyndicationFeed feed = new SyndicationFeed("TekConf Event", "Last 10 event added in TekConf", null);
List<SyndicationItem> items = TekConf.DataAccess.Event.GetLastEventsList(10).Select(
e => new SyndicationItem("idEvent : " + e.id + " : " + e.name,
e.location + ", " + e.time + " \n " + e.Technology + " \n " + e.description,
null)
).ToList();
feed.Items = items;
// Renvoie ATOM ou RSS en fonction de la chaîne de requête
// rss -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceLibrary1/Feed1/
// atom -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceLibrary1/Feed1/?format=atom
string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
SyndicationFeedFormatter formatter = null;
if (query == "atom")
{
formatter = new Atom10FeedFormatter(feed);
}
else
{
formatter = new Rss20FeedFormatter(feed);
}
return formatter;
}
开发者ID:camilleblondie,项目名称:tekconf,代码行数:27,代码来源:Feed1.cs
示例11: CreateFeed
public SyndicationFeedFormatter CreateFeed()
{
string serverUrl = ConfigurationManager.AppSettings["CatMyVideoUrl"];
// Create a new Syndication Feed.
SyndicationFeed feed = new SyndicationFeed();
feed.Id = "#CatMyVideo URL";
List<SyndicationItem> items = new List<SyndicationItem>();
feed.Title = new TextSyndicationContent("Last trends on CatMyVideo");
feed.Description = new TextSyndicationContent(String.Format("Todays' top {0} hottest videos on CatMyVideo", MAXVIDEO));
feed.Copyright = new TextSyndicationContent("Copy/Paste rights CatMyVideo");
feed.Generator = "CatMyVideo RSS Feeder 1.0";
feed.Authors.Add(new SyndicationPerson("[email protected]"));
feed.LastUpdatedTime = new DateTimeOffset(DateTime.Now);
var trendingVideos = Engine.BusinessManagement.Video.ListVideos(Engine.Dbo.Video.Order.UploadDate, false, MAXVIDEO, 0, true);
for (int i = 0; i < trendingVideos.Count; i++)
{
SyndicationItem item = new SyndicationItem();
string itemUrl = serverUrl + "/Video/Display/" + trendingVideos[i].Id;
item.Id = itemUrl;
var itemLink = new SyndicationLink(new Uri(itemUrl));
itemLink.MediaType = "text/html";
itemLink.Title = "Watch me !";
item.Links.Add(itemLink);
string htmlContent = String.Format("<!DOCTYPE html><html><head></head><body><h1>{0}</h1><p>{1}</p><a href=\"{2}\">Check this out !</a></body></html>",
trendingVideos[i].Title,
trendingVideos[i].Description,
itemUrl);
TextSyndicationContent content = new TextSyndicationContent(htmlContent, TextSyndicationContentKind.Html);
// Fill some properties for the item
item.Title = new TextSyndicationContent("#" + (i + 1));
item.LastUpdatedTime = DateTime.Now;
item.PublishDate = trendingVideos[i].UploadDate;
item.Content = content;
items.Add(item);
}
feed.Items = items;
string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
SyndicationFeedFormatter formatter = null;
if (query == "atom")
{
formatter = new Atom10FeedFormatter(feed);
}
else
{
formatter = new Rss20FeedFormatter(feed);
}
return formatter;
}
开发者ID:Flasheur111,项目名称:CatMyVideo,代码行数:60,代码来源:CatMyVideoFeeder.cs
示例12: fload
public void fload(string namefile)
{
var lines = System.IO.File.ReadAllLines(namefile);
feed.Title = new TextSyndicationContent(lines[1]);
feed.Copyright = new TextSyndicationContent(lines[2]);
feed.Description = new TextSyndicationContent(lines[3]);
feed.Generator = lines[4];
SyndicationLink link = new SyndicationLink();
link.Uri = new Uri(lines[5]);
feed.Links.Add(link);
feed.Items = txtgotolv("feedinfo.txt");
Response.Clear();
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ContentType = "text/xml";
XmlWriter Writer = XmlWriter.Create
(Response.Output);
if (lines[0] == "rss")
{
Rss20FeedFormatter Formatter = new Rss20FeedFormatter(feed);
Formatter.WriteTo(Writer);
}
else
{
if (lines[0] == "atom")
{
Atom10FeedFormatter Formatter = new Atom10FeedFormatter(feed);
Formatter.WriteTo(Writer);
}
}
Writer.Close();
Response.End();
}
开发者ID:1342MPA,项目名称:CourseProject,代码行数:32,代码来源:Default.aspx.cs
示例13: CreateFeedForBlog
public SyndicationFeedFormatter CreateFeedForBlog(string user, string blog)
{
SyndicationFeed feed = new SyndicationFeed("Blog feed", "A feed linked to a blog", null);
List<SyndicationItem> items = new List<SyndicationItem>();
List<Dbo.RssArticle> articles = BusinessManagement.Feed.GetBlogContent(user, blog);
foreach (Dbo.RssArticle article in articles)
{
SyndicationItem item = new SyndicationItem(article.Title, article.Content, null);
item.PublishDate = article.CreationDate;
items.Add(item);
}
feed.Items = items;
// Renvoie ATOM ou RSS en fonction de la chaîne de requête
// rss -> http://localhost:8733/Design_Time_Addresses/FluxRss/Feed1/
// atom -> http://localhost:8733/Design_Time_Addresses/FluxRss/Feed1/?format=atom
string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
SyndicationFeedFormatter formatter = null;
if (query == "atom")
{
formatter = new Atom10FeedFormatter(feed);
}
else
{
formatter = new Rss20FeedFormatter(feed);
}
return formatter;
}
开发者ID:ThomasCOLLIN,项目名称:dotNET,代码行数:30,代码来源:Feed.cs
示例14: CreateFeed
public SyndicationFeedFormatter CreateFeed()
{
// Create a new Syndication Feed.
SyndicationFeed feed = new SyndicationFeed("Bug Track", "Flux rss du bug track", null);
List<SyndicationItem> items = new List<SyndicationItem>();
// Create a new Syndication Item.
List<DBO.Bug> list = BusinessManagement.Bug.GetLastBug(10);
foreach (DBO.Bug itemBug in list)
{
SyndicationItem item = new SyndicationItem(itemBug.ProjectName + " : " + itemBug.Title, itemBug.CreateDate + " \n " + itemBug.Details, null);
items.Add(item);
}
feed.Items = items;
// Return ATOM or RSS based on query string
// rss -> http://localhost:8731/Design_Time_Addresses/SyndicationServiceBugTrack/Feed1/
// atom -> http://localhost:8731/Design_Time_Addresses/SyndicationServiceBugTrack/Feed1/?format=atom
string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
SyndicationFeedFormatter formatter = null;
if (query == "atom")
{
formatter = new Atom10FeedFormatter(feed);
}
else
{
formatter = new Rss20FeedFormatter(feed);
}
return formatter;
}
开发者ID:yoan-durand,项目名称:TP,代码行数:34,代码来源:Feed1.cs
示例15: GetXmlContents
private Action<Stream> GetXmlContents(IEnumerable<Post> model)
{
var items = new List<SyndicationItem>();
foreach (var post in model)
{
// Replace all relative urls with full urls.
var contentHtml = Regex.Replace(post.Content, UrlRegex, m => siteUrl.TrimEnd('/') + "/" + m.Value.TrimStart('/'));
var excerptHtml = Regex.Replace(post.ContentExcerpt, UrlRegex, m => siteUrl.TrimEnd('/') + "/" + m.Value.TrimStart('/'));
var item = new SyndicationItem(
post.Title,
contentHtml,
new Uri(siteUrl + post.Url)
)
{
Id = siteUrl + post.Url,
LastUpdatedTime = post.Date.ToUniversalTime(),
PublishDate = post.Date.ToUniversalTime(),
Content = new TextSyndicationContent(contentHtml, TextSyndicationContentKind.Html),
Summary = new TextSyndicationContent(excerptHtml, TextSyndicationContentKind.Html),
};
items.Add(item);
}
var feed = new SyndicationFeed(
AtomTitle,
AtomTitle, /* Using Title also as Description */
new Uri(siteUrl + "/" + feedfileName),
items)
{
Id = siteUrl + "/",
LastUpdatedTime = new DateTimeOffset(DateTime.Now),
Generator = "Sandra.Snow Atom Generator"
};
feed.Authors.Add(new SyndicationPerson(authorEmail, author, siteUrl));
var link = new SyndicationLink(new Uri(siteUrl + "/" + feedfileName))
{
RelationshipType = "self",
MediaType = "text/html",
Title = AtomTitle
};
feed.Links.Add(link);
var formatter = new Atom10FeedFormatter(feed);
return stream =>
{
var encoding = new UTF8Encoding(false);
var streamWrapper = new UnclosableStreamWrapper(stream);
using (var writer = new XmlTextWriter(streamWrapper, encoding))
{
formatter.WriteTo(writer);
}
};
}
开发者ID:horsdal,项目名称:Sandra.Snow,代码行数:60,代码来源:AtomResponse.cs
示例16: WriteFile
//var formatter = new Rss20FeedFormatter(feed);
// Atom10FeedFormatter formatter = new Atom10FeedFormatter(feed);
//using (var writer = XmlWriter.Create(response.Output, new XmlWriterSettings { Indent = true }))
//{
// formatter.WriteTo(writer);
//}
protected override void WriteFile(HttpResponseBase response)
{
Atom10FeedFormatter formatter = new Atom10FeedFormatter(_feed);
using (XmlWriter writer = XmlWriter.Create(response.OutputStream, new XmlWriterSettings { Indent = true }))
{
formatter.WriteTo(writer);
}
}
开发者ID:saeedesmaeili,项目名称:SimpleBlog,代码行数:14,代码来源:RssActionResult.cs
示例17: OnWriteToStream
public override void OnWriteToStream(Type type, object value, Stream stream, HttpContentHeaders contentHeaders, TransportContext context)
{
var formatter = new Atom10FeedFormatter((SyndicationFeed) value);
using (var xmlWriter = XmlWriter.Create(stream))
{
formatter.WriteTo(xmlWriter);
xmlWriter.Close();
}
}
开发者ID:ashic,项目名称:Hermes,代码行数:9,代码来源:AtomMediaTypeFormatter.cs
示例18: GetXmlContents
private static Action<Stream> GetXmlContents(SyndicationFeed feed)
{
return stream =>
{
var writer = new XmlTextWriter(stream, Encoding.UTF8);
var atomFormatter = new Atom10FeedFormatter(feed);
atomFormatter.WriteTo(writer);
};
}
开发者ID:jstclair,项目名称:Rosanna,代码行数:9,代码来源:AtomResponse.cs
示例19: Atom10ItemFormatter
public Atom10ItemFormatter(SyndicationItem itemToWrite)
: base(itemToWrite)
{
// No need to check that the parameter passed is valid - it is checked by the c'tor of the base class
this.feedSerializer = new Atom10FeedFormatter();
this.feedSerializer.PreserveAttributeExtensions = this.preserveAttributeExtensions = true;
this.feedSerializer.PreserveElementExtensions = this.preserveElementExtensions = true;
this.itemType = itemToWrite.GetType();
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:Atom10ItemFormatter.cs
示例20: Rss20FeedFormatter
public Rss20FeedFormatter(SyndicationFeed feedToWrite, bool serializeExtensionsAsAtom) : base(feedToWrite)
{
this.serializeExtensionsAsAtom = serializeExtensionsAsAtom;
this.maxExtensionSize = 0x7fffffff;
this.preserveElementExtensions = true;
this.preserveAttributeExtensions = true;
this.atomSerializer = new Atom10FeedFormatter(base.Feed);
this.feedType = feedToWrite.GetType();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:Rss20FeedFormatter.cs
注:本文中的System.ServiceModel.Syndication.Atom10FeedFormatter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论