#xml #html #nest

nestxml

Tools to easily nest XML or HTML elements

4 releases

✓ Uses Rust 2018 edition

new 0.2.2 Feb 18, 2019
0.2.1 Feb 17, 2019
0.2.0 Jan 26, 2019
0.1.0 Nov 13, 2018

#31 in #xml

Download history 13/week @ 2018-11-12 3/week @ 2018-11-19 13/week @ 2018-11-26 18/week @ 2018-12-03 1/week @ 2018-12-10 4/week @ 2018-12-17 8/week @ 2018-12-24 1/week @ 2018-12-31 3/week @ 2019-01-07 4/week @ 2019-01-14 8/week @ 2019-01-21 2/week @ 2019-01-28 2/week @ 2019-02-04 5/week @ 2019-02-11

21 downloads per month
Used in 1 crate

MIT license

7KB
128 lines

Documentation Crate MIT license

Purpose

Tools to easily nest XML or HTML elements


lib.rs:

Tools to nest XML or HTML elements. Relies on the xml-rs crate.

Example

use xml::EmitterConfig;

fn main() {
    let out = Vec::new();
    let mut out = EmitterConfig::new()
        .write_document_declaration(false)
        .create_writer(out);
    nestxml::element(&mut out, "contacts").write(|out| {
        nestxml::element(out, "first_name").text("John")?;
        nestxml::element(out, "last_name").text("Doe")
    }).unwrap();
    let out = out.into_inner();
    assert_eq!(&out[..], &b"<contacts><first_name>John</first_name>\
        <last_name>Doe</last_name></contacts>"[..]);
}

Dependencies

~187KB