fromXmlString static method
Implementation
static WebFeed fromXmlString(String xmlString) {
final rssVersion = detectRssVersion(xmlString);
switch (rssVersion) {
case RssVersion.rss1:
final rss1Feed = Rss1Feed.parse(xmlString);
return WebFeed.fromRss1(rss1Feed);
case RssVersion.rss2:
final rss2Feed = RssFeed.parse(xmlString);
return WebFeed.fromRss2(rss2Feed);
case RssVersion.atom:
final atomFeed = AtomFeed.parse(xmlString);
return WebFeed.fromAtom(atomFeed);
case RssVersion.unknown:
throw Error.safeToString('Invalid XML String? We cannot detect RSS/Atom version.');
default:
throw Exception('Some error has occured.');
}
}