einfach_xml_builder/
lib.rs

1//! # xml-builder-rs
2//!  A lightweight and intuitive library for generating XML documents in Rust. With an easy-to-use API, it allows you to create well-formed XML structures programmatically. Add elements, attributes, namespaces, and CDATA sections effortlessly. 
3//! 
4//! ## Features
5//! 
6//! - Create XML declarations with specified version, encoding, and standalone attributes.
7//! - Build XML elements with namespaces, attributes, and child elements.
8//! - Generate XML strings from the constructed XML documents.
9//! 
10//! ## Installation
11//! 
12//! Add the following line to your `Cargo.toml` file:
13//! 
14//! ```toml
15//! [dependencies]
16//! xml_builder = "0.1.0"
17//! ```
18//! 
19//! ## Usage
20//! Here's an example of how to use XML Builder to construct an XML document:
21
22//! ```rust
23//! use xml_builder::{Declaration, Element, Attribute, Namespace};
24//! 
25//! fn main() {
26//!     // Create an XML declaration
27//!     let declaration = Declaration::new("1.0", "UTF-8").with_standalone(true);
28//! 
29//!     // Create an XML element
30//!     let element = Element::new("root")
31//!         .add_namespace(Namespace::new("android", "http://example.com"))
32//!         .add_attribute(Attribute::new("attr1", "value1"))
33//!         .add_attribute(Attribute::new("attr2", "value2"))
34//!         .add_child(Element::new("child1"))
35//!         .add_child(Element::new("child2"));
36//! 
37//!     // Create a builder with the declaration and element
38//!     let builder = Builder::new(declaration, element);
39//! 
40//!     // Print the XML document
41//!     println!("{}", builder.to_string());
42//! }
43//! ```
44mod declaration;
45mod attribute;
46mod element;
47mod namespace;
48mod builder;
49
50pub use self::declaration::*;
51pub use self::attribute::*;
52pub use self::element::*;
53pub use self::namespace::*;
54pub use self::builder::*;