9 unstable releases (4 breaking)

Uses old Rust 2015

0.4.0 Oct 10, 2017
0.2.1 Oct 11, 2016
0.1.4 Mar 31, 2016
0.1.2 Apr 11, 2015
0.1.1 Feb 20, 2015

#150 in Value formatting

Download history 278/week @ 2023-10-19 204/week @ 2023-10-26 201/week @ 2023-11-02 184/week @ 2023-11-09 216/week @ 2023-11-16 213/week @ 2023-11-23 178/week @ 2023-11-30 177/week @ 2023-12-07 195/week @ 2023-12-14 208/week @ 2023-12-21 197/week @ 2023-12-28 198/week @ 2024-01-04 338/week @ 2024-01-11 265/week @ 2024-01-18 142/week @ 2024-01-25 151/week @ 2024-02-01

952 downloads per month
Used in 17 crates (4 directly)

MIT/Apache

13KB
267 lines

XmlWriter

a no fluff, minimalistic, zero-copy xml writer for Rust.

Usage

extern crate xml_writer;
use xml_writer::::XmlWriter;

let mut xml = XmlWriter::new(Vec::new()); // supply any Writer, preferrably BufferedWriter
xml.begin_elem("root");
    xml.comment("nice to see you");
    xml.begin_elem("node");
        xml.attr_esc("name", "\"123\"");
        xml.attr("id", "abc");
        xml.attr("'unescaped'", "\"123\""); // this WILL intentionally generate invalid xml
        xml.text("'text'");
    xml.end_elem();
    xml.begin_elem("stuff");
        xml.cdata("blablab");
    // xml.end_elem(); // the latter close() will close all open nodes
 // xml.end_elem();
 xml.close();
 xml.flush();

let actual = xml.into_inner();

Changes

0.2.0

  • add XmlWriter::empty_elem to write an empty element

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.

No runtime deps