DocumentMetadata.fromXmlElement constructor

DocumentMetadata.fromXmlElement(
  1. XmlElement xml
)

Creates a DocumentMetadata from an XML <meta> tag inside EPUB <metadata>.

Implementation

factory DocumentMetadata.fromXmlElement(XmlElement xml) {
  return DocumentMetadata(
    refinesTo: xml.getAttribute('refines')?.substring(1),
    property: xml.getAttribute('property'),
    value: xml.innerText.isNotEmpty ? xml.innerText : null,
    id: xml.getAttribute('id'),
    scheme: xml.getAttribute('scheme'),
    name: xml.getAttribute('name'),
    content: xml.getAttribute('content'),
  );
}