arquery 0.1.0

An async fork of rquery
Documentation
  • Coverage
  • 93.75%
    30 out of 32 items documented1 out of 13 items with examples
  • Size
  • Source code size: 32.87 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.73 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • nanocryk/arquery
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nanocryk

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");
}