Item.fromXmlElement constructor
Creates an Item from an XML <item>
tag inside EPUB <manifest>
.
Implementation
factory Item.fromXmlElement(
XmlElement xml, {
required Epub source,
Item? mediaOverlay,
}) {
return Item(
id: xml.getAttribute('id')!,
source: source,
href: xml.getAttribute('href')!,
mediaType: ItemMediaType.fromValue(xml.getAttribute('media-type')!),
mediaOverlay: mediaOverlay,
properties: xml
.getAttribute('properties')
?.split(' ')
.map((property) => ItemProperty.fromValue(property))
.toList() ??
[],
);
}