pub fn mark_compact_elements(node: &mut Value)Expand description
Mark elements written as a single-line “compact” wrapper around exactly one nested
child element, with zero whitespace between the wrapper’s start tag, the child, and
the wrapper’s end tag – e.g. Salesforce Flow’s
<connector><targetReference>X</targetReference></connector> idiom. Marks by
inserting "#compact": true on the wrapper element itself; build_xml_string
consumes and strips it to render the wrapper and its single child on one line.
Must run on the freshly parsed tree before strip_whitespace_text_nodes, which
removes whitespace-only #text/#cdata/#text-tail this depends on: once removed,
“never had whitespace” (compact) and “had whitespace, now stripped” (block) are
indistinguishable from the object alone.
Does not recurse into Value::String/Number/etc; call on each of the document
root’s own child values (not the root wrapper itself, which always has exactly one
key – the root element – and would otherwise always be marked compact).