Skip to main content

Module response

Module response 

Source
Expand description

Reading values out of a multistatus body.

§What this reader is

A targeted scanner: it finds an element by its exact qualified name and yields the slice between its tags. Namespace prefixes are compared literally and never resolved, which is sound for Nextcloud’s WebDAV answers because the server uses the same d/oc/nc prefixes this crate writes.

§What it deliberately is not

  • It does not expand namespace declarations, so a server answering with a different prefix (<D:href>) is not understood. The caller sees a missing element, never a wrong value.
  • It does not validate well-formedness. It does skip comments, CDATA sections and processing instructions, and it respects quoted attribute values, so a < inside those cannot start a false match.
  • It decodes only the five XML entities plus numeric character references (see escape).

Every lookup returns Option, so an unreadable property is omitted rather than guessed at.

Functions§

elements
Every element with name, in document order.
first_element
First element with name.
has_element
Whether any element with name is present.
require_element
Requires name to be present, reporting it by name when absent.
text_of
Text of the first element with name, if it is present.