private void LoadAtomFeed(XDocument doc, RssFeed feed) { SetMediaImage(feed, doc); feed.Description = doc.Root.GetSafeElementString("summary"); feed.Items = new ObservableCollection<RssItem>(); feed.LastBuildDate = doc.Root.GetSafeElementDate("updated"); feed.Link = doc.Root.GetLink("self"); foreach (var item in doc.Root.Elements(doc.Root.GetDefaultNamespace() + "entry")) { var newItem = new RssItem() { Title = item.GetSafeElementString("title"), Description = item.GetSafeElementString("description"), PublishDate = item.GetSafeElementDate("published"), Guid = item.GetSafeElementString("id"), Link = item.GetLink("alternate"), }; feed.Items.Add(newItem); } }
private void LoadRssFeed(XDocument doc, RssFeed feed) { SetMediaImage(feed, doc); feed.Description = doc.Root.Element("channel").GetSafeElementString("description"); feed.Items = new ObservableCollection<RssItem>(); feed.Link = doc.Root.Element("channel").GetSafeElementString("link"); foreach (var item in doc.Descendants("item")) { var newItem = new RssItem() { Title = item.GetSafeElementString("title"), Link = item.GetSafeElementString("link"), Description = item.GetSafeElementString("description"), PublishDate = item.GetSafeElementDate("pubDate"), Guid = item.GetSafeElementString("guid"), }; feed.Items.Add(newItem); } var lastItem = feed.Items.OrderByDescending(i => i.PublishDate).FirstOrDefault(); if (lastItem != null) { feed.LastBuildDate = lastItem.PublishDate; } }
private void LoadRssFeed(XDocument doc, RssFeed feed) { SetMediaImage(feed, doc); feed.Description = doc.Root.GetSafeElementString("description"); feed.Items = new ObservableCollection<RssItem>(); feed.LastBuildDate = doc.Root.GetSafeElementDate("pubDate"); feed.Link = doc.Root.GetSafeElementString("link"); foreach (var item in doc.Descendants("item")) { var newItem = new RssItem() { Title = item.GetSafeElementString("title"), Link = item.GetSafeElementString("link"), Description = item.GetSafeElementString("description"), PublishDate = item.GetSafeElementDate("pubDate"), Guid = item.GetSafeElementString("guid"), }; feed.Items.Add(newItem); } }