AtomFeed.parse constructor

AtomFeed.parse(
  1. String xmlString
)

Factory method to parse an XML string and create an AtomFeed object from it.

The xmlString is an XML representation of the Atom feed.

Returns the parsed AtomFeed object.

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._fromXml(feedElement);
}