question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When XmlAccessType.NONE is annotated, values annotated with XmlAttribute are not parsed

See original GitHub issue

After the implementation of #1649, values annotated (in Java) with XmlAttribute are not parsed and must be annotated with XmlElement (which is a nice workaround). As far as I understand it, the annotation of XmlAttribute should also result in parsing the value.

@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@ApiModel(description = "A class that describes a user profile")
public class Profile {

    @XmlAttribute
    @ApiModelProperty(value = "The name", required = true)
    private String name;

    @XmlElement
    @ApiModelProperty(value = "The address", required = true)
    private String address;

        private String secretKey;
}

Here, address would be parsed, the name would not be parsed.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
clovis-guillemotcommented, Aug 30, 2017

@fehguy can you please merge this PR #2409 to fix this issue. Thanks !

1reaction
fehguycommented, Dec 25, 2016

This is a bug–if you have time for a PR for a test and/or fix, it’d be appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JAXB annotations for groovy attribute classes - Stack Overflow
I get the full list of desired skills printed (5 of them), so I know the values are in the database already. To...
Read more >
Guide to JAXB Annotations - HowToDoInJava
FIELD – Every non-static, non-transient field in a JAXB-bound class will be automatically bound to XML, unless annotated by XmlTransient .
Read more >
XmlAccessType (Java Platform SE 8 ) - Oracle Help Center
Every non static, non transient field in a JAXB-bound class will be automatically bound to XML, unless annotated by XmlTransient . NONE. None...
Read more >
Jakarta XML Binding
However it is a non goal in Jakarta XML Binding specification, ... either explicitly or via default mapping, with the mapping annotation @XmlAttribute...
Read more >
JAXB hello world example - Mkyong.com
XmlAccessType ; import jakarta.xml.bind.annotation. ... public fields, and JAXB annotated non-public fields for XML conversion.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found