arquery

Crates.ioarquery
lib.rsarquery
version0.1.0
sourcesrc
created_at2020-04-15 10:29:12.935391
updated_at2020-04-15 10:29:12.935391
descriptionAn async fork of rquery
homepage
repositoryhttps://github.com/nanocryk/arquery
max_upload_size
id230446
size32,800
(nanocryk)

documentation

https://docs.rs/arquery/

README

arquery

arquery crate arquery documentation

A Sync + Send simple implementation of a HTML/XML DOM tree which allows simple operations like querying by CSS selectors, makes dealing with XML files less painful.

Fork of rquery without reference-counting.

Example

use arquery::Document;

fn main() {
  let document = Document::new_from_xml_file("tests/fixtures/sample.xml").unwrap();

  let title = document.select("title").unwrap();
  assert_eq!(title.text(), "Sample Document");
  assert_eq!(title.attr("ref").unwrap(), "main-title");

  let item_count = document.select_all("item").unwrap().count();
  assert_eq!(item_count, 2);

  let item_titles = document.select_all("item > title").unwrap()
    .map(|element| element.text().clone())
    .collect::<Vec<String>>()
    .join(", ");
  assert_eq!(item_titles, "Another Sample, Other Sample");
}
Commit count: 36

cargo fmt