RssItem.parse constructor

RssItem.parse(
  1. XmlElement element,
  2. bool parseHtml
)

Parse constructor for the RssItem class, used when 'parsing' a feed

Implementation

factory RssItem.parse(XmlElement element, bool parseHtml) => RssItem(
      title: element.findElements('title').firstOrNull?.parseText(parseHtml),
      description: element
          .findElements('description')
          .firstOrNull
          ?.parseText(parseHtml),
      link: element.findElements('link').firstOrNull?.innerText,
      categories:
          element.findElements('category').map(RssCategory.parse).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?.parseText(parseHtml),
      source: element.findElements('source').map(RssSource.parse).firstOrNull,
      content: element
          .findElements('content:encoded')
          .map(RssContent.parse)
          .firstOrNull,
      media: Media.parse(element, parseHtml),
      enclosure: element
          .findElements('enclosure')
          .map(RssEnclosure.parse)
          .firstOrNull,
      dc: DublinCore.parse(element, parseHtml),
      itunes: Itunes.parse(element, parseHtml),
    );