1#![deny(missing_docs)]
2
3//! A minimal DOM crate built on top of quick-xml.
4//!
5//! This library exports an `Element` struct which represents a DOM tree.
6//!
7//! # Example
8//!
9//! Run with `cargo run --example articles`. Located in `examples/articles.rs`.
10//!
11//! ```rust,ignore
12//! extern crate minidom;
13//!
14//! use minidom::Element;
15//!
16//! const DATA: &'static str = r#"<articles xmlns="article">
17//! <article>
18//! <title>10 Terrible Bugs You Would NEVER Believe Happened</title>
19//! <body>
20//! Rust fixed them all. <3
21//! </body>
22//! </article>
23//! <article>
24//! <title>BREAKING NEWS: Physical Bug Jumps Out Of Programmer's Screen</title>
25//! <body>
26//! Just kidding!
27//! </body>
28//! </article>
29//! </articles>"#;
30//!
31//! const ARTICLE_NS: &'static str = "article";
32//!
33//! #[derive(Debug)]
34//! pub struct Article {
35//! title: String,
36//! body: String,
37//! }
38//!
39//! fn main() {
40//! let root: Element = DATA.parse().unwrap();
41//!
42//! let mut articles: Vec<Article> = Vec::new();
43//!
44//! for child in root.children() {
45//! if child.is("article", ARTICLE_NS) {
46//! let title = child.get_child("title", ARTICLE_NS).unwrap().text();
47//! let body = child.get_child("body", ARTICLE_NS).unwrap().text();
48//! articles.push(Article {
49//! title: title,
50//! body: body.trim().to_owned(),
51//! });
52//! }
53//! }
54//!
55//! println!("{:?}", articles);
56//! }
57//! ```
58//!
59//! # Usage
60//!
61//! To use `minidom`, add this to your `Cargo.toml` under `dependencies`:
62//!
63//! ```toml,ignore
64//! minidom = "*"
65//! ```
66
67pub use quick_xml;
68
69pub mod convert;
70pub mod element;
71pub mod error;
72mod namespace_set;
73pub mod node;
74
75#[cfg(test)]
76mod tests;
77
78pub use convert::IntoAttributeValue;
79pub use element::{Children, ChildrenMut, Element, ElementBuilder};
80pub use error::{Error, Result};
81pub use namespace_set::NSChoice;
82pub use node::Node;