RssItem.parse constructor

RssItem.parse(
  1. XmlElement element
)

Implementation

factory RssItem.parse(XmlElement element) {
  return RssItem(
    title: element.findElements('title').firstOrNull?.innerText,
    description: element.findElements('description').firstOrNull?.innerText,
    link: element.findElements('link').firstOrNull?.innerText,
    categories: element
        .findElements('category')
        .map((e) => RssCategory.parse(e))
        .toList(),
    guid: element.findElements('guid').firstOrNull?.innerText,
    pubDate:
        parseDateTime(element.findElements('pubDate').firstOrNull?.innerText),
    author: element.findElements('author').firstOrNull?.innerText,
    comments: element.findElements('comments').firstOrNull?.innerText,
    source: element
        .findElements('source')
        .map((e) => RssSource.parse(e))
        .firstOrNull,
    content: element
        .findElements('content:encoded')
        .map((e) => RssContent.parse(e))
        .firstOrNull,
    media: Media.parse(element),
    enclosure: element
        .findElements('enclosure')
        .map((e) => RssEnclosure.parse(e))
        .firstOrNull,
    dc: DublinCore.parse(element),
    itunes: Itunes.parse(element),
  );
}