1
0
Fork 0
mirror of https://gitlab.com/news-flash/article_scraper.git synced 2025-07-08 08:30:00 +02:00

update to new serialization api of libxml

This commit is contained in:
Jan Lukas Gernert 2019-09-26 21:28:05 +02:00
parent b489af74bd
commit 2137e84743
3 changed files with 29 additions and 5 deletions

View file

@ -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)