using System; using System.Linq; using System.Xml.Linq; using System.Collections.Generic; using Aggregator.Classes; namespace Aggregator.Parser { public static class Parser { public static IEnumerable
Parse(string xml, Config config) { return XDocument.Parse(xml).Descendants("item") .Select(articles => articles.Descendants().ToArray()) .Select(article => new Article() { Source = config.Source, Title = article[config.Title].Value, Description = article[config.Description].Value, ArticleLink = article[config.ArticleLink].Value, ImageLink = article[config.ImageLink].Attribute("url").Value, PublishDate = DateTime.Parse(article[config.PublishDate].Value) }).Distinct().ToArray(); } public static IEnumerable> ParseMultiple(string xmls) { } } }