Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mitsuhiko/elementtree-rust

Port of the Python element tree library to Rust
https://github.com/mitsuhiko/elementtree-rust

Last synced: 4 days ago
JSON representation

Port of the Python element tree library to Rust

Awesome Lists containing this project

README

        

# ElementTree for Rust

[![Build Status](https://github.com/mitsuhiko/elementtree-rust/workflows/Tests/badge.svg?branch=master)](https://github.com/mitsuhiko/elementtree-rust/actions?query=workflow%3ATests)
[![Crates.io](https://img.shields.io/crates/d/elementtree.svg)](https://crates.io/crates/elementtree)
[![License](https://img.shields.io/github/license/mitsuhiko/elementtree-rust)](https://github.com/mitsuhiko/elementtree-rust/blob/master/LICENSE)
[![rustc 1.56.0](https://img.shields.io/badge/rust-1.56%2B-orange.svg)](https://img.shields.io/badge/rust-1.56%2B-orange.svg)
[![Documentation](https://docs.rs/elementtree/badge.svg)](https://docs.rs/elementtree)

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.

## Example

```rust
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());
}
```

## License and Links

- [Documentation](https://docs.rs/elementtree/)
- [Issue Tracker](https://github.com/mitsuhiko/elementtree-rust/issues)
- [Examples](https://github.com/mitsuhiko/elementtree-rust/tree/master/examples)
- License: [MIT](https://github.com/mitsuhiko/elementtree-rust/blob/master/LICENSE)