#xml #parse #elementtree

elementtree

Parse an XML file into Python elementtree like structure

6 releases (breaking)

0.5.0 Jun 13, 2017
0.4.0 Apr 22, 2017
0.3.0 Apr 18, 2017
0.2.0 Mar 30, 2017
0.1.1 Mar 28, 2017

#85 in Graphics APIs

Download history 20/week @ 2018-08-23 14/week @ 2018-08-30 31/week @ 2018-09-06 22/week @ 2018-09-13 20/week @ 2018-09-20 38/week @ 2018-09-27 49/week @ 2018-10-04 14/week @ 2018-10-11 124/week @ 2018-10-18 18/week @ 2018-10-25 34/week @ 2018-11-01 49/week @ 2018-11-08 67/week @ 2018-11-15

110 downloads per month
Used in 7 crates (4 directly)

BSD-3-Clause

43KB
843 lines

ElementTree for Rust

API Documentation

This library parses XML into a Python ElementTree like structure. It currently has basic support for reading and writing with pretty good namespace support and the ability to inspect the file.

It's not recommended to use this for larger documents as the entire document will be loaded into memory. However it's pretty good for working with configuration files and similar things.

Installation

Add this to your Cargo.toml

[dependencies]
elementtree = "0"

Example

let root = Element::from_reader(r#"

    
        
        
        
    

"#.as_bytes()).unwrap();
let list = root.find("{tag:myns}list").unwrap();
for child in list.find_all("{tag:myns}item") {
    println!("attribute: {}", child.get_attr("{tag:otherns}attr").unwrap());
}

Dependencies

~680KB
~13K SLoC