-
Notifications
You must be signed in to change notification settings - Fork 277
Closed
Labels
enhancementserdeIssues related to mapping from Rust types to XMLIssues related to mapping from Rust types to XML
Description
I have struct Person.
#[derive(serde::Serialize)]
pub struct Person {
name: String,
age: i32,
}and I want to parse it to XML string:
<Person><name>Foo</name><age>20</age></Person>But I can't find a way to do it in quick-xml. https://docs.rs/quick-xml/0.22.0/quick_xml/se/fn.to_string.html
#[derive(serde::Serialize)]
pub struct Person {
name: String,
age: i32,
}
fn main() {
let person = Person {
name: "Foo".to_string(),
age: 20,
};
let data_xml = quick_xml::se::to_string(&person).unwrap(); // how to have open-closed tag ??
println!("{}", data_xml);
}My current workaround is to use serde_xml_rs.
let data_xml = serde_xml_rs::to_string(&person).unwrap();Is there a way to do this? So that I don't need multiple XML dependencies.
Thanks for quick-xml
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementserdeIssues related to mapping from Rust types to XMLIssues related to mapping from Rust types to XML