Opml.parse constructor
Opml.parse(
- String opmlString
Implementation
factory Opml.parse(String opmlString) {
XmlDocument element = XmlDocument.parse(opmlString);
XmlNode? opml = findFirstElement(element, 'opml');
XmlNode? head = findFirstElement(opml, 'head');
XmlNode body = findFirstElement(opml, 'body')!;
return Opml(
title: findFirstElement(head, 'title')?.text,
dateCreated: parseDateTime(findFirstElement(head, 'dateCreated')?.text),
dateModified: parseDateTime(findFirstElement(head, 'dateModified')?.text),
ownerName: findFirstElement(head, 'ownerName')?.text,
ownerEmail: findFirstElement(head, 'ownerEmail')?.text,
ownerId: findFirstElement(head, 'ownerId')?.text,
docs: findFirstElement(head, 'docs')?.text,
expansionState: findFirstElement(head, 'expansionState')?.text,
vertScrollState: findFirstElement(head, 'vertScrollState')?.text,
windowTop: findFirstElement(head, 'windowTop')?.text,
windowLeft: findFirstElement(head, 'windowLeft')?.text,
windowBottom: findFirstElement(head, 'windowBottom')?.text,
windowRight: findFirstElement(head, 'windowRight')?.text,
items:
body.findElements('outline').map((e) => OpmlItem.parse(e)).toList(),
);
}