tafia / quick-xml

Rust high performance xml reader and writer
MIT License
1.18k stars 235 forks source link

How to represent any node using this library and Serde #805

Closed eirnym closed 1 week ago

eirnym commented 1 week ago

I'd like to represent any node as is without mapping this value to an object, like I can do with serde_json::Value. This is often useful when node could not be mapped strictly or I'd like to load XML, edit part of it and save XML back without actually manipulating data where I don't need to

#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct RootNode {
    known: KnownType,
    unknown: Vec<Value>,
}

pub struct KnownType {
   data: Option<()>,
}

for Vec<Value> I'd prefer just Value, but it could be impossible

Mingun commented 1 week ago

Duplicate of #257

eirnym commented 1 week ago

@Mingun this issue doesn't represent serialization, which is crucial for me as well