Skip to main content

Module serializer

Module serializer 

Source
Expand description

Serialize a sup_xml_tree::dom::Document back to XML text.

Mirrors the existing crate::serializer module — same option type (crate::SerializeOptions), same escaping rules, same compact and pretty-print layouts — but walks the arena tree (Node::children() / Node::attributes() iterators) rather than the legacy Vec<Node> / Vec<Attribute> fields.

§Example

use sup_xml_core::{parse_str, serialize_to_string, ParseOptions};
let doc = parse_str("<r><a id='1'/></r>", &ParseOptions::default()).unwrap();
let xml = serialize_to_string(&doc);
assert!(xml.contains(r#"<a id="1"/>"#));

Structs§

SerializeOptions
Options that control how a Document is serialized back to XML text.

Functions§

serialize_formatted
Serialize an arena Document with pretty-printing (newlines + indentation).
serialize_html_to_string
Serialize an arena Document as HTML5. Emits the DOCTYPE if the document carries one, never emits an XML declaration, uses HTML5 void- element / raw-text / boolean-attribute conventions. Same shape as crate::serialize_html_to_string but accepts the arena tree.
serialize_node_to_string
Serialize a single Node (and its descendants) without the surrounding document machinery (no XML declaration, no DOCTYPE). Used by the libxml2 ABI shim’s xmlNodeDump and by callers that want a subtree string.
serialize_to_bytes
Serialize an arena Document to a compact UTF-8 byte vector.
serialize_to_string
Serialize an arena Document to a compact XML string with default options.
serialize_with
Serialize an arena Document with full control via SerializeOptions.