convertProp method

(WebDavStdResError?, String?, Iterable<WebDavStdResourceProp>) convertProp(
  1. XmlElement root,
  2. WebDavStdResource resource
)

Implementation

(WebDavStdResError?, String?, Iterable<WebDavStdResourceProp>) convertProp(
  XmlElement root,
  WebDavStdResource resource,
) {
  switch ((root.namespaceUri, root.localName)) {
    case (null, "error"):
    case (kDavNamespaceUrlStr, "error"):
      final error = parserManger.error?.convert(root);
      return (error, null, const []);
    case (kDavNamespaceUrlStr, "propstat"):
      final props = parserManger.propstat?.convert((
        node: root,
        resource: resource,
      ));
      if (props == null) break;
      return (null, null, props);
    case (kDavNamespaceUrlStr, "prop"):
      final props = root
          .findElements("*", namespace: root.namespaceUri)
          .map(
            (e) => parserManger
                .fetchPropParser(e.localName, e.namespaceUri)
                ?.convert((
                  node: e,
                  status: resource.status,
                  error: resource.error,
                  desc: resource.desc,
                )),
          )
          .whereNotNull();
      return (null, null, props);
  }
  return (null, null, const []);
}