/* * This work is licensed under the Creative Commons Attribution 2.5 License. * To view a copy of this license, visit http://creativecommons.org/licenses/by/2.5/ * or send a letter to Creative Commons, 543 Howard Street, 5th Floor, * San Francisco, California, 94105, USA. * * Original developer: David Betz * */ using System; using System.Collections.Generic; using System.Text; using Atom.Core; using System.Collections.ObjectModel; namespace FeedBuilder { public class AtomReader : AbstractReader { private AtomFeed atomFeed; public AtomFeed AtomFeed { get { return atomFeed; } set { atomFeed = value; } } public override String FeedLink { get { return this.AtomFeed.Links[1].HRef.AbsoluteUri; } } public override String FeedTitle { get { return this.AtomFeed.Title.Content; } } public AtomReader() { } public AtomReader(String data) { this.AtomFeed = AtomFeed.LoadXml(data); } public override Collection GetEntryList() { Collection simpleFeed = new Collection(); foreach (AtomEntry entry in this.AtomFeed.Entries) { SimpleFeedEntry simpleEntry = new SimpleFeedEntry(); simpleEntry.Date = entry.Modified.DateTime; simpleEntry.Link = entry.Links[1].HRef.AbsoluteUri; simpleEntry.Text = entry.Contents[0].Content; simpleEntry.Title = entry.Title.Content; simpleFeed.Add(simpleEntry); } return simpleFeed; } } }