Skip to main content

serialize_inner_html

Function serialize_inner_html 

Source
pub fn serialize_inner_html(doc: &Document, id: NodeId, buf: &mut String)
Expand description

Serializes only the children of a node to HTML (inner HTML).

This is equivalent to calling serialize_node on each child and concatenating the results.

ยงExamples

use scrape_core::{Soup, serialize::serialize_inner_html};

let soup = Soup::parse("<div><span>A</span><span>B</span></div>");
let doc = soup.document();
let div_id = soup.find("div").unwrap().unwrap().node_id();

let mut html = String::new();
serialize_inner_html(doc, div_id, &mut html);
assert_eq!(html, "<span>A</span><span>B</span>");