xml_data/lib.rs
1#![warn(missing_docs)]
2#![doc(html_root_url = "https://docs.rs/xml-data/0.0.1")]
3//! This library provides a generic interface to parse XML data: a user might implement how to
4//! parse and serialize their data (possibly derived), while others will implement adaptors for
5//! generic XML parsers.
6//!
7//! This is similar to what serde does; but serde assumes your data consists of "native data"
8//! (strings, integers, floats, ...) and nested data (lists and maps). XML doesn't map to this
9//! very well; while there are some adaptors, they often accept lots of structually different input
10//! data: an element might be interpreted as map in serde. A subelement with text now can be
11//! interpreted as key (`<key>value</key>`), but an attribute is interpreted the same way `<...
12//! key="value">`.
13//!
14//! This library focuses only on XML instead, and provides a more strict interface with clearly
15//! defined output.
16//!
17//! For the following XML handling crates adaptors are included if enabled through the equally
18//! named features:
19//! - [`quick-xml`](https://crates.io/crates/quick-xml)
20//!
21//! If the `derive` feature is enabled the following traits can be derived:
22//! - `Element`
23//! - `parser::Element`
24//! - `serializer::Element`
25//! - `Inner`
26//! - `parser::Inner`
27//! - `serializer::Inner`
28
29pub mod errors;
30pub mod extensions;
31pub mod parser;
32pub mod serializer;
33mod traits;
34
35/// For now we use a simple boxed error to show the user
36pub type Error = Box<dyn std::error::Error>;
37/// Result alias with out error type included
38pub type Result<T> = std::result::Result<T, Error>;
39
40#[cfg(feature = "quick-xml")]
41pub mod quick_xml;
42
43#[cfg(any(test, feature = "_private-test"))]
44mod test_struct;
45
46pub use self::traits::{
47 Element,
48 Inner,
49};