tl 0.2.1

html parser written in rust
Documentation

tl

tl is an efficient and easy to use HTML parser written in Rust. It does minimal to no copying during parsing by borrowing parts of the input string. Additionally, it keeps track of parsed elements and stores elements with an id attribute in an internal HashMap, which makes element lookups by ID/class name very fast.

Examples

Finding an element by its id attribute and printing the inner text:

fn main() {
    let input = r#"<p id="text">Hello</p>"#;
    let dom = tl::parse(input);
    let element = dom.get_element_by_id("text").expect("Failed to find element");

    println!("Inner text: {}", element.inner_text());
}

Usage

Add tl to your dependencies.

[dependencies]
tl = "0.1.1"