toXML method
Implementation
XMLNode toXML() {
final node = XMLNode.xmlns(
tag: 'file',
xmlns: fileMetadataXmlns,
children: List.empty(growable: true),
);
if (mediaType != null) {
node.addChild(XMLNode(tag: 'media-type', text: mediaType));
}
if (width != null) {
node.addChild(XMLNode(tag: 'width', text: '$width'));
}
if (height != null) {
node.addChild(XMLNode(tag: 'height', text: '$height'));
}
if (desc != null) {
node.addChild(XMLNode(tag: 'desc', text: desc));
}
if (length != null) {
node.addChild(XMLNode(tag: 'length', text: length.toString()));
}
if (name != null) {
node.addChild(XMLNode(tag: 'name', text: name));
}
if (size != null) {
node.addChild(XMLNode(tag: 'size', text: size.toString()));
}
for (final hash in hashes.entries) {
node.addChild(
constructHashElement(hash.key, hash.value),
);
}
for (final thumbnail in thumbnails) {
node.addChild(
thumbnail.toXML(),
);
}
return node;
}