Shale is a Ruby object mapper and serializer for JSON, YAML, TOML, CSV and XML. It allows you to parse JSON, YAML, TOML, CSV and XML data and convert it into Ruby data structures, as well as serialize data structures into JSON, YAML, TOML, CSV or XML.
Add
preserve_namespaces: true
in the XML block to save XML namespaces for child elements of the document. As originally discussed at https://github.com/lutaml/xmi/pull/8#issuecomment-2133412262