Skip to content
New issue

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

Attribute and element with same name #163

Open
KrullBorg opened this issue Sep 21, 2023 · 1 comment
Open

Attribute and element with same name #163

KrullBorg opened this issue Sep 21, 2023 · 1 comment
Labels
enhancement New feature or request wait feedback The issue is addressed, wait a reply from the author

Comments

@KrullBorg
Copy link

i have a simple xml where there are an attribute and an inner element with the same name and i get the error conflicting implementations of trait "yaserde::Visitor<'_>" for type "_IMPL_YA_DESERIALIZE_FOR..."

<car type="suv">
  <type>new</type>
</car>

is it possible to parse it with yaserde?

thanks in advance

@MarcAntoine-Arnaud MarcAntoine-Arnaud added the enhancement New feature or request label Feb 6, 2024
@MarcAntoine-Arnaud
Copy link
Contributor

Hi @KrullBorg ,

I have addressed this case in 9c2d04b

Please check with YaSerDe version > 9.2.

Just to be sure, you have to use the rename like:

struct Car {
  #[yaserde(attribute, rename = "type")]
  field1: String,
  #[yaserde(rename = "type")]
  field2: String,
} 

Enjoy !

@MarcAntoine-Arnaud MarcAntoine-Arnaud added the wait feedback The issue is addressed, wait a reply from the author label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wait feedback The issue is addressed, wait a reply from the author
Projects
None yet
Development

No branches or pull requests

2 participants