XML parsing and building utilities for WebDAV.
Handles namespace-aware parsing of request bodies (PROPFIND, PROPPATCH, LOCK) and generation of multistatus XML responses using Saxy.
Summary
Functions
Check whether a resolved element matches the DAV: namespace with the given local name.
Build a property element for a standard DAV: property.
Build an XML error response body.
Extract {namespace, local_name} tuples from child elements of a <prop> element.
Find the first child element matching {DAV:, local_name}.
Build a <D:lockdiscovery> element from a list of active locks.
Build a full lock response body (for LOCK method responses).
Build a complete 207 Multi-Status XML response body.
Parse an XML string into a namespace-resolved tree.
Build a <D:resourcetype> element — empty for files, contains
<D:collection/> for collections.
Build a <D:response> element for a single resource.
Build the <D:supportedlock> element advertising exclusive and shared write locks.
Types
Functions
Check whether a resolved element matches the DAV: namespace with the given local name.
@spec dav_property(String.t(), String.t() | tuple() | nil) :: Saxy.XML.element()
Build a property element for a standard DAV: property.
Build an XML error response body.
@spec extract_property_names([resolved_element() | String.t()]) :: [ {String.t(), String.t()} ]
Extract {namespace, local_name} tuples from child elements of a <prop> element.
@spec find_dav_child([resolved_element() | String.t()], String.t()) :: resolved_element() | nil
Find the first child element matching {DAV:, local_name}.
@spec lock_discovery_element([Davy.LockStore.lock_info()]) :: Saxy.XML.element()
Build a <D:lockdiscovery> element from a list of active locks.
@spec lock_response(Davy.LockStore.lock_info()) :: iodata()
Build a full lock response body (for LOCK method responses).
@spec multistatus([Saxy.XML.element()]) :: iodata()
Build a complete 207 Multi-Status XML response body.
@spec parse(String.t()) :: {:ok, resolved_element()} | {:error, term()}
Parse an XML string into a namespace-resolved tree.
Returns {:ok, resolved_tree} or {:error, reason}.
Each element becomes {namespace, local_name, attributes, children}.
@spec resourcetype_element(:file | :collection) :: Saxy.XML.element()
Build a <D:resourcetype> element — empty for files, contains
<D:collection/> for collections.
@spec response_element(String.t(), [ {pos_integer(), [{String.t(), Saxy.XML.element()}]} ]) :: Saxy.XML.element()
Build a <D:response> element for a single resource.
propstats is a list of {status_code, [{property_name, value_element}]}.
@spec supported_lock_element() :: Saxy.XML.element()
Build the <D:supportedlock> element advertising exclusive and shared write locks.