# xml-creator [![Latest version](https://img.shields.io/crates/v/xml-creator.svg)](https://crates.io/crates/xml-creator) [![Documentation](https://docs.rs/xml-creator/badge.svg)](https://docs.rs/xml-creator) [![License](https://img.shields.io/crates/l/xml-creator.svg)]() A Rust library for building a simple xml (with childs, attributes, CDATA...) [Documentation](https://docs.rs/xml-creator) ## Usage Add this to your `Cargo.toml`: ```toml [dependencies] xml-creator = "0.0.1" ``` and/or this to your crate root: ```rust extern crate xml_creator; ``` ## Example ```rust use std::io; fn main() -> io::Result<()> { use std::fs::File; use xml_creator::XMLElement; /* let mut file = File::create("example.xml").unwrap(); */ let mut file: Vec = Vec::new(); let mut company = XMLElement::new("company"); company.add_attribute("name", "val"); let mut employee = XMLElement::new("employee"); // no escaping and CDATA needed employee.add_text("Max Mustermann".to_string(), false, false); let mut cdata = XMLElement::new("cdata"); // will get wrapped into CDATA cdata.add_text("

Some Html

".to_string(), false, true); company.add_child(cdata); let mut escape = XMLElement::new("escape"); // < will get escaped escape.add_text("<".to_string(), true, false); company.add_child(escape); // add employee to company company.add_child(employee); company.write(file)..unwrap(); Ok(()) } ``` `example.xml` will contain: ``` Max Mustermann Some Html

]]>
<
```