[−][src]Function serde_xml_rs2::ser::to_string_with_namespaces
pub fn to_string_with_namespaces<S: Serialize>(
value: &S,
namespaces: BTreeMap<String, String>
) -> Result<String, Error>
A convenience method for serializing some object to a string, with xml namespaces.
Examples
#[derive(Serialize)] struct Person { name: String, age: u32, } let mut namespaces = BTreeMap::new(); namespaces.insert("".to_string(), "http://example.com/schema.xsd".to_string()); let joe = Person {name: "Joe".to_string(), age: 42}; // An empty key indicates a global namespace let serialized = to_string_with_namespaces(&joe, namespaces).unwrap(); println!("{}", serialized);