AtomFeed.parse constructor
AtomFeed.parse(
- String xmlString
Implementation
factory AtomFeed.parse(String xmlString) {
var document = XmlDocument.parse(xmlString);
var feedElement = document.findElements('feed').firstOrNull;
if (feedElement == null) {
throw ArgumentError('feed not found');
}
return AtomFeed(
id: feedElement.findElements('id').firstOrNull?.text,
title: feedElement.findElements('title').firstOrNull?.text,
updated:
parseDateTime(feedElement.findElements('updated').firstOrNull?.text),
items: feedElement
.findElements('entry')
.map((e) => AtomItem.parse(e))
.toList(),
links: feedElement
.findElements('link')
.map((e) => AtomLink.parse(e))
.toList(),
authors: feedElement
.findElements('author')
.map((e) => AtomPerson.parse(e))
.toList(),
contributors: feedElement
.findElements('contributor')
.map((e) => AtomPerson.parse(e))
.toList(),
categories: feedElement
.findElements('category')
.map((e) => AtomCategory.parse(e))
.toList(),
generator: feedElement
.findElements('generator')
.map((e) => AtomGenerator.parse(e))
.firstOrNull,
icon: feedElement.findElements('icon').firstOrNull?.text,
logo: feedElement.findElements('logo').firstOrNull?.text,
rights: feedElement.findElements('rights').firstOrNull?.text,
subtitle: feedElement.findElements('subtitle').firstOrNull?.text,
);
}