We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I will take liberty with opening new issue with this one. I'm looking for an information how to use namespaces with flatten. Eg.:
flatten
use yaserde_derive::YaDeserialize; #[derive(Default, YaDeserialize)] #[yaserde( root = "Root", prefix = "nsa", namespace = "nsa: http://nsa.com", namespace = "nsb: http://nsb.com" )] struct Root { #[yaserde(rename = "Root.basic", prefix = "nsa", text)] basic: String, #[yaserde(flatten)] child: Child, } #[derive(Default, YaDeserialize)] struct Child { #[yaserde(rename = "Child.param", prefix = "nsa", text)] param: String, #[yaserde(flatten)] child2: Child2, } #[derive(Default, YaDeserialize)] struct Child2 { #[yaserde(rename = "Child2.param", prefix = "nsb", text)] param: String, } #[cfg(test)] mod tests { use crate::Root; #[test] fn parses() { const XML: &str = r##" <nsa:Root xmlns:nsa="http://dupa.com" xmlns:nsb="http://nsb.com" > <nsa:Root.basic>Value</nsa:Root.basic> <nsa:Child.param>ValueC</nsa:Child.param> <nsb:Child2.param>ValueD</nsb:Child2.param> </nsa:Root> "##; let _: Root = yaserde::de::from_str(XML).unwrap(); } }
Doesn't work.
As a background: I'm working on rust code generated from inheritance model. I would prefer to avoid manual flattening of these structs.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I will take liberty with opening new issue with this one. I'm looking for an information how to use namespaces with
flatten
.Eg.:
Doesn't work.
As a background: I'm working on rust code generated from inheritance model. I would prefer to avoid manual flattening of these structs.
The text was updated successfully, but these errors were encountered: