XML parsing helpers for WebDAV/CalDAV multistatus responses.
Uses Saxy.SimpleForm to parse the XML body, then walks the
D:response elements to extract the properties commonly returned by
CalDAV servers (displayname, calendar-description, getctag,
getetag, calendar-data, and resourcetype). Only properties whose
enclosing D:propstat has a 200 OK status are returned; failed
properties (404, 403, etc.) are silently dropped.
Relative href values are resolved against the caller-supplied
base_url so downstream consumers always see absolute URLs.
Summary
Types
Parsed D:response element, with the most commonly-requested CalDAV
properties extracted into a flat map.
Functions
Parses a WebDAV/CalDAV D:multistatus XML body.
Types
@type response() :: %{ href: String.t() | nil, display_name: String.t() | nil, description: String.t() | nil, ctag: String.t() | nil, etag: String.t() | nil, calendar_data: String.t() | nil, is_calendar: boolean() }
Parsed D:response element, with the most commonly-requested CalDAV
properties extracted into a flat map.
Functions
@spec parse_multistatus(String.t(), String.t()) :: {:ok, [response()]} | {:error, CalDAVEx.Error.t()}
Parses a WebDAV/CalDAV D:multistatus XML body.
Parameters
body- the raw XML response bodybase_url- the server base URL used to resolve relativehrefvalues
Returns
{:ok, [map]}- a list of maps with keys:href,:display_name,:description,:ctag,:etag,:calendar_data, and:is_calendar{:error, %CalDAVEx.Error{type: :xml}}if the body is not well-formed XML