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 740625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:32:17+00:00 2026-05-14T08:32:17+00:00

We have XML such as shown below. We have a corresponding Team, Players, and

  • 0

We have XML such as shown below. We have a corresponding Team, Players, and Player Java classes. We use JAXB to unmarshall the XML.

<team>
   <players>
      <player>
         <name>Le Bron</name>
         <age>23</age>
      </player>

      <player>
         <name>Shaq</name>
         <age>33</age>
      </player>
   </players>
</team>

What I’d like is to not have the Players class as it doesn’t add any value.

I tried just removing the Players class and adding the annotation below to the Team class but it didn’t work. I think JAXB is expecting the <Player> elements to be directly one level below Team.

Any ideas?

@XmlElement(name = "Player")
protected List<Player> players;
  • 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-05-14T08:32:17+00:00Added an answer on May 14, 2026 at 8:32 am

    You need to add the @XmlElementWrapper annotation:

    @XmlElementWrapper(name = "Players")
    @XmlElement(name = "Player")
    protected List<Player> players;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have such xml: <bean id=conversionService class=org.springframework.context.support.ConversionServiceFactoryBean> <property name=converters> <list> <bean class=converters.AddressToStringConverter /> <bean
I have to parse a 1Gb XML file with a structure such as below
I have two classes, shown below: [Serializable] [XmlInclude(typeof(SomeDerived))] public class SomeBase { public string
I have some classes that already use DOM4J to read XML files and provide
I have such XML structure which was returned by SharePoint web services. <rs:data ItemCount=4
I have xml file with such structure: ... <outer> ... <inner/> ... </outer> ...
I have an xml string such as this: <s:Envelope xmlns:s=http://schemas.xmlsoap.org/soap/envelope/> <s:Body> <ExecuteResponse xmlns=http://schemas.microsoft.com/xrm/2011/Contracts/Services> <ExecuteResult
I would like to ask such question, I have XML xsd`s, which generate beans
I have a class decorated with XML attributes such as [XmlAttribute(att)]. My goal is
I have a maven dependency in my pom.xml as such: <dependency> <groupId>com.foo</groupId> <artifactId>Bar</artifactId> <version>1.2.3</version>

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.