Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7896243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:50:38+00:00 2026-06-03T07:50:38+00:00

I am trying to Unmarshal the following xml: <datas xmlns=http://www… xmlns:atom=http://www.w3.org/2005/atom> <data> <atom:link rel=data

  • 0

I am trying to Unmarshal the following xml:

  <datas xmlns="http://www..." xmlns:atom="http://www.w3.org/2005/atom">
     <data>
         <atom:link rel="data" type="application/xml" href="http://www.../ckp/data/1"/>
     </data>
     <data>
       <atom:link rel="data" type="application/xml" href="http://www.../ckp/data/2"/>
     </data>
     <data>
        <atom:link rel="data" type="application/xml" href="http://www.../ckp/data/3"/>
     </data>
  </datas>

And I wrote the following binding classes to aid achieve Marshalling/Unmarshalling:

public class Links{

@XmlAttribute
private String rel;
@XmlAttribute
private String type;
@XmlAttribute
private String href;


public String getRel() {
    return rel; 
}

public void setRel(String rel) {
    this.rel = rel;
}
public String getType() {
    return type;    
}

public void setType(String type) {
    this.type = type;
}
public String getHref() {
    return href;    
}

public void setHref(String href) {
    this.href = href;
}

second model class

@XmlAccessorType(XmlAccessType.FIELD)
public class AuthorMeta {

@XmlElement
private Atomlink author;

public Atomlink getLink() {
    return author;
}

public void setLink(Atomlink link) {
    this.author = link;
}

The last model class, this will actually be bind with the retrieved xml

   @XmlRootElement(name="datas")
   @XmlAccessorType(XmlAccessType.FIELD)
   public class Datas{



    @XmlAttribute
    private String datas;
    @XmlElement
    private String data;
    @XmlValue
private List<DataMeta> link;



public String getDatas() {
    return datas;
}
public String getData() {
    return data;
}

public List<DataMeta> getAtom() {
    return link;
}

public void setDatas(String datas) {
    this.datas= datas;
}

public void setData(String data) {
    this.data= data;
}



public void setLink(List<DataMeta> link) {
    this.link = link;
}




}

But during the deployement i’m taking an error which says:

  Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts  of IllegalAnnotationExceptions
  If a class has @XmlElement property, it cannot have @XmlValue property.
this problem is related to the following location:
    at private java.util.List org.client.model.Datas.link
    at org.client.model.Datas
this problem is related to the following location:
    at private java.lang.String org.client.model.Datas.data
    at org.client.model.Datas
   @XmlAttribute/@XmlValue need to reference a Java type that maps to text in XML.
this problem is related to the following location:
    at private java.util.List org.client.model.Datas.link
    at org.client.model.Datas

I’m not familiar with annotations but could anyone say to me how to use them in this specific occasion. I want to create with the annotations something like this:

<xmlattribute>
  <xmlelement>
    <xml sub-child/>
  </xmlelement>
  <xmlelement>
    <xml sub-child/>
  </xmlelement>
</xmlattribute>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:50:40+00:00Added an answer on June 3, 2026 at 7:50 am

    The exception hold the answers. Try this instead.

    @XmlElement
    private List<AuthorMeta> link;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to unmarshal the following XML, but am receiving an error. <ItemSearchResponse xmlns=http://webservices.amazon.com/AWSECommerceService/2011-08-01>
I'm trying to unmarshal a simple xml document from a public api from Convio.
I have an XML file that I'm trying to unmarshal, but I cant figure
I've got the following code, I'm trying to send data text by sockets. But
I am trying to unmarshall the following xml file with the method Jaxb.unmarshall(String,Class) .
I am trying to unmarshall the following XML using JAXB: <Works> <Work> <Composers> <Composer>
I have some xml data I'm trying to unmarshall into java objects and one
I am trying to unmarshall data from an XML object in Java using SimpleXML.
I am trying deserialize XML data into newly created Java content trees: I am
I am getting a GSON error trying to unmarshal JSON into an object. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.