Skip to main content

xml_to_toml

Function xml_to_toml 

Source
pub fn xml_to_toml(xml: &str) -> Result<String, Box<dyn Error>>
Expand description

Converts XML to TOML via the canonical hub.

Attribute markers (@name) and text markers (#text) are preserved as quoted TOML keys, allowing round-trip back to XML.

§Errors

Returns an error if the XML is malformed or cannot be represented in TOML.

§Examples

use sheeter_engine::xml_to_toml;
let toml = xml_to_toml("<r><a>1</a></r>").unwrap();
assert!(toml.contains("a = \"1\""));