webdav-serde
A Rust library for parsing and serializing WebDAV XML responses using quick-xml and serde.
Features
- Parse WebDAV
multistatusXML responses - Serialize Rust structs to WebDAV XML format
- Support for all common WebDAV properties
- Helper methods for working with WebDAV responses
Installation
Add this to your Cargo.toml:
[]
= "0.1.2"
Usage
Parsing WebDAV XML
use Multistatus;
let xml = r#"<?xml version="1.0" encoding="utf-8"?>
<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>/file.txt</D:href>
<D:propstat>
<D:prop>
<D:getcontentlength>1024</D:getcontentlength>
<D:getlastmodified>Mon, 13 Nov 2023 14:52:27 GMT</D:getlastmodified>
<D:resourcetype></D:resourcetype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>"#;
let multistatus = from_xml.unwrap;
for response in &multistatus.response
Command Line Tool
Parse WebDAV XML files from the command line:
This will display:
- Full parsed structure
- Summary of collections and files
- List of files with sizes
Supported Properties
displayname- Display name of the resourcecreationdate- Creation dategetcontentlength- File size in bytesgetcontenttype- MIME typegetetag- Entity taggetlastmodified- Last modification datelockdiscovery- Lock informationresourcetype- Resource type (collection or file)supportedlock- Supported lock types
Examples
See the xml/ directory for example WebDAV responses from different servers.
License
MIT
use from_str;
use Multistatus;