media-io / yaserde

Yet Another Serializer/Deserializer
MIT License
179 stars 60 forks source link

Be able to obtain current namespace in deserialize and serialize #123

Closed jose-pr closed 3 years ago

jose-pr commented 3 years ago

Is there any way to obtain the current namespace that applies to an object (before its own) and use this information in the deserialize functions. I want to obtain a namespace from the prefix as I may need to save this value in a struct.

Working with a ws-discovery probe type message where a element value has a namespace and i want to save the namespace in the struct.

Maybe pass the namespace to the deserialize function if possible

impl YaDeserialize for A{
    fn deserialize<R: std::io::Read>(
        reader: &mut yaserde::de::Deserializer<R>,
       ns: xml::namespace::Namespace
    ) -> Result<Self, String>
jose-pr commented 3 years ago

My bad I think i see this info on the reader did pay much attention.