aboutsummaryrefslogtreecommitdiff
path: root/Aggregator/Parser
diff options
context:
space:
mode:
authorAryadev Chavali <aryadevchavali1@gmail.com>2019-02-04 00:09:04 +0000
committerAryadev Chavali <aryadevchavali1@gmail.com>2019-02-04 00:09:04 +0000
commit2f2bdf7ea0f6ac23f39e0d867e93a90374cc21ae (patch)
tree65fc07f6c80083d1e4c14d9727cb722a75578670 /Aggregator/Parser
parent47e8e85487d02bd3ce85d016eb251df48436b159 (diff)
downloadnewsaggregator-2f2bdf7ea0f6ac23f39e0d867e93a90374cc21ae.tar.gz
newsaggregator-2f2bdf7ea0f6ac23f39e0d867e93a90374cc21ae.tar.bz2
newsaggregator-2f2bdf7ea0f6ac23f39e0d867e93a90374cc21ae.zip
Finished ParseMultiple method
Diffstat (limited to 'Aggregator/Parser')
-rw-r--r--Aggregator/Parser/Parser.cs10
1 files changed, 7 insertions, 3 deletions
diff --git a/Aggregator/Parser/Parser.cs b/Aggregator/Parser/Parser.cs
index c9ad038..9e91a77 100644
--- a/Aggregator/Parser/Parser.cs
+++ b/Aggregator/Parser/Parser.cs
@@ -17,10 +17,14 @@ namespace Aggregator.Parser {
ArticleLink = article[config.ArticleLink].Value,
ImageLink = article[config.ImageLink].Attribute("url").Value,
PublishDate = DateTime.Parse(article[config.PublishDate].Value)
- }).Distinct().ToArray();
+ }).Distinct();
}
- public static IEnumerable<IEnumerable<Article>> ParseMultiple(string xmls) {
-
+ public static IEnumerable<Article> ParseMultiple(string[] xmls, List<Config> configs) {
+ if (configs.Count == 0 || xmls.Length == 0 || (xmls.Length != configs.Count)) {
+ return null;
+ } else {
+ return xmls.Select((xml, index) => Parse(xml, configs[index])).SelectMany(i => i);
+ }
}
}
} \ No newline at end of file