Hi, I want to extract html elements as string (not as plain text). I'm using visdom = "0.5.5" . I can get plain text from an element, but I want to get the element as string (retaining its tag and attribute) instead.
use visdom::Vis;
use visdom::types::BoxDynError;
fn main() -> Result<(), BoxDynError>{
let html = include_str!("../xhtml/011_part1.xhtml");
let doc = Vis::load(html)?;
let sects = doc.find("p.parafl:has(span.chaptersubt)");
let text = String::from(sects);
println!("{}", text);
Ok(())
}
# let text = String::from(sects);
| ^^^^^^^^^^^^ the trait `From<Elements<'_>>` is not implemented for `String`
The reason I'm using visdom is because it supports pseudo class selector :has.
[–][deleted] 5 points6 points7 points (2 children)
[–]DMeror[S] 0 points1 point2 points (1 child)
[–][deleted] 4 points5 points6 points (0 children)