Giter VIP home page Giter VIP logo

Comments (8)

MarcAntoine-Arnaud avatar MarcAntoine-Arnaud commented on May 26, 2024

Looks cool.

Just a question: is it required to une an XPath ?
In your case it can be defined in rust like:

struct Reply {
    #[serde(rename = "$xml:path:Container")]
    container: Container
}

struct Container {
    #[serde(rename = "$xml:path:Container")]
    items: vec<i32>
}

but using the XPath is more generic.

Do you plan to develop this feature ? I need it during next month, and for that I will probably work on it soon.

from serde-xml-rs.

RReverser avatar RReverser commented on May 26, 2024

Using such kind of names will break serde for other destination types since they don't know anything about $xml: prefix and it will be treated as part of the field name (which is what rename is for).

from serde-xml-rs.

MarcAntoine-Arnaud avatar MarcAntoine-Arnaud commented on May 26, 2024

Yes made sense.
So do you think we can purpose Serde to add the field target to solve that ?

#[rename(rename = "container", target=json)]
#[rename(rename = "$xml:path:Container", target=xml)]
field: Type

or

#[rename(rename = "container"), target=json)]
#[rename(rename = "$xml:path:Container"), target=xml)]
field: Type

from serde-xml-rs.

RReverser avatar RReverser commented on May 26, 2024

I don't know, maybe? That issue should go on serde repo.

from serde-xml-rs.

vosmith avatar vosmith commented on May 26, 2024

I've just started getting into rust. Reading the response from the serde-rs project, are you still considering how to allow serialization for attributes?

from serde-xml-rs.

MarcAntoine-Arnaud avatar MarcAntoine-Arnaud commented on May 26, 2024

Regarding exchange with Serde Core developers, I started a new project to support that.
You can found it here: https://github.com/media-io/yaserde

from serde-xml-rs.

Boscop avatar Boscop commented on May 26, 2024

@MarcAntoine-Arnaud Does yaserde already support telling the serializer to serialize a struct field as a xml attribute? Or what is the current progress status of yaserde?

It seems to support it via #[yaserde(attribute)], does it also support something like #[serde(rename = "..")] in addition to that? :)

Can yaserde be used to serialize to all kinds of xml documents that one could want, or are some things unsupported?

from serde-xml-rs.

MarcAntoine-Arnaud avatar MarcAntoine-Arnaud commented on May 26, 2024

@Boscop please follow the discussion here.

from serde-xml-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.