mirror of
https://gitlab.com/news-flash/article_scraper.git
synced 2025-07-08 16:40:00 +02:00
update to new serialization api of libxml
This commit is contained in:
parent
b489af74bd
commit
2137e84743
3 changed files with 29 additions and 5 deletions
15
src/lib.rs
15
src/lib.rs
|
@ -19,7 +19,8 @@ use libxml::parser::Parser;
|
|||
use libxml::xpath::Context;
|
||||
use libxml::tree::{
|
||||
Document,
|
||||
Node
|
||||
Node,
|
||||
SaveOptions,
|
||||
};
|
||||
use std::path::PathBuf;
|
||||
use std::ops::Index;
|
||||
|
@ -128,7 +129,17 @@ impl ArticleScraper {
|
|||
}
|
||||
|
||||
// serialize content
|
||||
let html = document.to_string(/*format:*/ false);
|
||||
let options = SaveOptions {
|
||||
format: false,
|
||||
no_declaration: false,
|
||||
no_empty_tags: true,
|
||||
no_xhtml: false,
|
||||
xhtml: false,
|
||||
as_xml: false,
|
||||
as_html: true,
|
||||
non_significant_whitespace: false,
|
||||
};
|
||||
let html = document.to_string_with_options(options);
|
||||
article.html = Some(html);
|
||||
|
||||
Ok(article)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue