| Crates.io | domparser |
| lib.rs | domparser |
| version | 0.0.7 |
| created_at | 2025-12-22 04:10:42.246027+00 |
| updated_at | 2025-12-26 03:55:06.838505+00 |
| description | A super fast html parser and manipulator written in rust. |
| homepage | |
| repository | https://github.com/utooland/domparser-rs |
| max_upload_size | |
| id | 1999024 |
| size | 67,998 |
A super fast html parser and manipulator written in rust.
Add this to your Cargo.toml:
[dependencies]
domparser = "0.0.5"
use domparser::parse;
fn main() {
let html = r#"<div id="foo" class="bar">hello <span>world</span></div>"#;
let root = parse(html.to_string());
let div = root.select("div".to_string()).unwrap();
println!("{}", div.get_attribute("id".to_string()).unwrap()); // "foo"
println!("{}", div.text()); // "hello world"
div.set_attribute("title".to_string(), "my-title".to_string());
println!("{}", div.outer_html());
// <div id="foo" class="bar" title="my-title">hello <span>world</span></div>
}