1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Serde XML (de)serialization.
//!
//! This module provides `from_str` / `to_string` functions for converting between
//! XML text and Rust types via serde. It requires the `serde` feature.
//!
//! # Conventions
//!
//! - Element children map to struct fields by tag name
//! - Attributes are accessed via the `$attr` prefix: `#[serde(rename = "$attr:class")]`
//! - Text content is accessed via `$text`: `#[serde(rename = "$text")]`
//! - Sequences (repeated elements) are collected into `Vec<T>`
//! - The root element name is used as the struct name (or overridden via `#[serde(rename)]`)
//!
//! # Examples
//!
//! ```
//! # #[cfg(feature = "serde")]
//! # {
//! use serde::{Deserialize, Serialize};
//!
//! #[derive(Debug, Deserialize, Serialize, PartialEq)]
//! #[serde(rename = "book")]
//! struct Book {
//! #[serde(rename = "$attr:isbn")]
//! isbn: String,
//! title: String,
//! author: String,
//! }
//!
//! let xml = r#"<book isbn="978-0"><title>Rust</title><author>Alice</author></book>"#;
//! let book: Book = xmloxide::serde_xml::from_str(xml).unwrap();
//! assert_eq!(book.isbn, "978-0");
//! assert_eq!(book.title, "Rust");
//!
//! let xml_out = xmloxide::serde_xml::to_string(&book).unwrap();
//! assert!(xml_out.contains("<title>Rust</title>"));
//! # }
//! ```
pub use from_str;
pub use Error;
pub use to_string;