#xml #parse #xmltree

xmltree

Parse an XML file into a simple tree-like structure

10 releases (6 breaking)

0.8.0 Feb 7, 2018
0.6.1 Sep 26, 2017
0.4.0 Mar 26, 2017
0.3.2 Apr 23, 2016
0.2.1 Aug 19, 2015

#9 in Parsing tools

Download history 751/week @ 2018-05-06 1292/week @ 2018-05-13 1054/week @ 2018-05-20 724/week @ 2018-05-27 1273/week @ 2018-06-03 1528/week @ 2018-06-10 1252/week @ 2018-06-17 1033/week @ 2018-06-24 1295/week @ 2018-07-01 1378/week @ 2018-07-08 1391/week @ 2018-07-15 1427/week @ 2018-07-22 971/week @ 2018-07-29

4,901 downloads per month

xmltree-rs

Documention

A small library for parsing an XML file into an in-memory tree structure.

Not recommended for large XML files, as it will load the entire file into memory.

https://crates.io/crates/xmltree

Usage

Add the following to your Cargo.toml file:

[dependencies]
xmltree = "0.7"

and this to yoru crate root:

extern crate xmltree;

Example

See the documentation for the latest version:

https://docs.rs/xmltree/


lib.rs:

A simple library for parsing an XML file into an in-memory tree structure

Not recommended for large XML files, as it will load the entire file into memory.

Example

use xmltree::Element;
use std::fs::File;

let data: &'static str = r##"


    
    

"##;

let mut names_element = Element::parse(data.as_bytes()).unwrap();

println!("{:#?}", names_element);
{
    // get first `name` element
    let name = names_element.get_mut_child("name").expect("Can't find name element");
    name.attributes.insert("suffix".to_owned(), "mr".to_owned());
}
names_element.write(File::create("result.xml").unwrap());


MIT license

Dependencies

Reverse deps