You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do have an XML where i am only interested in certain nodes and attributes, but I do need the other nodes and attributes of the XML to serialize them again later. I don't know what these nodes are called and what attributes they have and if they have additional subnodes.
Example
#[derive(Debug,Deserialize,Serialize)]structA{#[serde(rename = "@B")]b:B,#[serde(flatten)]
other: ???,// How to capture additional elements with their attributes?}#[derive(Debug,Deserialize,Serialize)]structB{#[serde(rename = "@battribute")]attribute:String,#[serde(flatten)]other:Map<String,String>,// any additional attributes}
...let xml = r#" <?xml version="1.0" encoding="utf-8"?> <A> <B battribute="..." /> <C cattribite1="..." cattribute2=""> <D dattribute1="..." </D> </C> </A>"#;
I was able to capture additional attribute with
#[serde(flatten)]
other:Map<String,String>,// any additional attributes
I do have an XML where i am only interested in certain nodes and attributes, but I do need the other nodes and attributes of the XML to serialize them again later. I don't know what these nodes are called and what attributes they have and if they have additional subnodes.
Example
I was able to capture additional attribute with
But i don't know how to achieve this with full nodes. So i am looking for a serde_json::Value equivalent to perform what is described in the serde docs https://serde.rs/attr-flatten.html#capture-additional-fields
Thx for help
The text was updated successfully, but these errors were encountered: