#html #css #parser

victoria-dom

Minimalistic HTML parser with CSS selectors

3 releases

Uses old Rust 2015

0.1.2 Jun 5, 2018
0.1.1 Apr 11, 2017
0.1.0 Jul 26, 2016

#1679 in Parser implementations

Download history 11/week @ 2023-02-09 38/week @ 2023-02-16 6/week @ 2023-02-23 14/week @ 2023-03-02 31/week @ 2023-03-09 14/week @ 2023-03-16 18/week @ 2023-03-23 23/week @ 2023-03-30 27/week @ 2023-04-06 11/week @ 2023-04-13 10/week @ 2023-04-20 43/week @ 2023-04-27 36/week @ 2023-05-04 24/week @ 2023-05-11 8/week @ 2023-05-18 17/week @ 2023-05-25

105 downloads per month
Used in sel

MIT/Apache

135KB
3.5K SLoC

victoria-dom

Minimalistic HTML parser with CSS selectors

crates.io Build Status Coverage Status Released API docs Master API docs

The project has been inspired by Mojo::DOM.

Installing

Add the following lines to your Cargo.toml file:

[dependencies]
victoria-dom = "0.1"

and this to your crate root:

extern crate victoria_dom;

Examples

extern crate victoria_dom;

use victoria_dom::DOM;

fn main() {
    let html = r#"<html><div id="main">Hello, <a href="http://rust-lang.org" alt="The Rust Programing Language">Rust</a></div></html>"#;
    let dom = DOM::new(html);

    assert_eq!(dom.at("html").unwrap().text_all(), "Hello, Rust");
    assert_eq!(dom.at("div#main > a").unwrap().attr("alt").unwrap(), "The Rust Programing Language");
}

Documentation

https://docs.rs/victoria-dom

Dependencies

~1–1.4MB
~39K SLoC