Skip to main content

parse_xml

Function parse_xml 

Source
pub fn parse_xml(text: &str) -> Result<CdmKvn, CdmError>
Expand description

Parse a CDM in XML format.

Parses the document with roxmltree (a real XML DOM reader: the <?xml?> declaration, comments, namespaces, entity escaping, and encoding are handled by the library, not by string scanning), then reads the header and relative-metadata leaf elements by name from the document and the per-object state/covariance from the two <segment> subtrees. The CCSDS CDM XML schema is flat, so a name match uniquely identifies each value. The full 6x6 RTN covariance is recovered when its complete velocity block is present; a stray or partial velocity element (e.g. a lone CRDOT_R) is canonicalized away. Date/time fields are returned verbatim for the host to resolve, matching parse_kvn; text that is not well-formed XML is rejected with CdmError::MalformedXml and an object block missing any state component with CdmError::IncompleteStateVector. Every covariance component is required and every accepted numeric state/covariance value must be finite.