pub fn encode_xml(cdm: &CdmKvn) -> Result<String, CdmError>Expand description
Encode a CdmKvn to a CCSDS 508.0-B-1 CDM XML document.
The date/time fields are taken as already-formatted strings (the host owns the instant-to-string conversion), and numeric values use the shortest round-tripping decimal form, so the output is round-trip faithful rather than byte-identical to any one producer. String values are XML-escaped.
This is a controlled straight-line serializer (no parsing, no tag scanning)
rather than a generic streaming-writer dependency: the output is a fixed,
documented CCSDS layout (cdm > header/body > segment > metadata/data) whose
element nesting and units attributes are the inter-system exchange contract,
and every interpolated value is escaped via [xml::escape]. The matching
reader is the vetted roxmltree DOM parser in parse_xml.