PodcastItem.parse constructor

PodcastItem.parse(
  1. XmlElement element
)

Factory method to parse an XmlElement and create a PodcastItem object from it.

The element is an XML element containing the podcast item information.

Returns the parsed PodcastItem object.

Implementation

factory PodcastItem.parse(XmlElement element) {
  return PodcastItem(
    transcript: element
        .findElements('podcast:transcript')
        .map((e) => Transcript.parse(e))
        .firstOrNull,
    chapters: element
        .findElements('podcast:chapters')
        .map((e) => Chapters.parse(e))
        .firstOrNull,
    soundbites: element
        .findElements('podcast:soundbite')
        .map((e) => Soundbite.parse(e))
        .toList(),
    people: element
        .findElements('podcast:person')
        .map((e) => Person.parse(e))
        .toList(),
    location: element
        .findElements('podcast:location')
        .map((e) => Location.parse(e))
        .firstOrNull,
    season: element
        .findElements('podcast:season')
        .map((e) => Season.parse(e))
        .firstOrNull,
    episode: element
        .findElements('podcast:episode')
        .map((e) => Episode.parse(e))
        .firstOrNull,
    license: element
        .findElements('podcast:license')
        .map((e) => License.parse(e))
        .firstOrNull,
    alternateEnclosures: element
        .findElements('podcast:alternateEnclosure')
        .map((e) => AlternateEnclosure.parse(e))
        .toList(),
    value: element
        .findElements('podcast:value')
        .map((e) => Value.parse(e))
        .firstOrNull,
    images: element
        .findElements('podcast:images')
        .map((e) => Images.parse(e))
        .firstOrNull,
    contentLinks: element
        .findElements('podcast:contentLink')
        .map((e) => ContentLink.parse(e))
        .toList(),
  );
}