convert method
Iterable<WebDavStdResourceProp>
convert(
- ({XmlElement node, WebDavStdResource resource}) input
override
Converts input
and returns the result of the conversion.
Implementation
@override
Iterable<WebDavStdResourceProp> convert(
({XmlElement node, WebDavStdResource resource}) input) {
final statusNode = input.node.getElement(WebDavElementNames.status,
namespace: input.node.namespaceUri);
final errorNode = input.node.getElement(WebDavElementNames.error,
namespace: input.node.namespaceUri);
final propNode = input.node.getElement(WebDavElementNames.prop,
namespace: input.node.namespaceUri);
final descNode = input.node.getElement(
WebDavElementNames.responsedescription,
namespace: input.node.namespaceUri);
final status =
statusNode != null ? _statusParser.convert(statusNode) : null;
if (status == null && input.resource.status == HttpStatus.multiStatus) {
throw WebDavParserDataError("Can't parse status", data: input.node);
}
final error = errorNode != null ? _errorParser?.convert(errorNode) : null;
final desc = descNode?.innerText;
if (propNode == null) return const [];
return propNode.childElements
.map((e) => _parserManager
.fetchPropParser<WebDavStdResourceProp>(
e.localName, e.namespaceUri)
?.convert((
node: e,
status: status ?? input.resource.status,
error: error ?? input.resource.error,
desc: desc ?? input.resource.desc,
)))
.whereNotNull();
}