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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:01:07+00:00 2026-06-12T03:01:07+00:00

I have been provided an XSD file to unmarshall the XML returned from an

  • 0

I have been provided an XSD file to unmarshall the XML returned from an external web service.

I’m able to unmarshall the XML I receive into the JAXB classes. But due to the depth of the structure of the JAXB classes generated I’m not sure on how to null check the code while retrieving values.

Example to retrieve a students name, the code is as follows –

jaxbResponse.getStudentDetails().get(0).getStudent().get(0).getName().get(0).getGivenName();

It gets really messy if I have to null check and index check the lists this code returns.

This is just an example, I need to get around 50 parameters with code similar to the above code. I have no idea when I’m going to get a NullPointerException or an IndexOutofBoundsException.

I’m new to working with JaxB classes, I need some help.

Thanks in advance.

  • 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-12T03:01:09+00:00Added an answer on June 12, 2026 at 3:01 am

    The pattern of your example looks like a List generated from a simple <xs:element minOccurs="{something}" maxOccurs="unbounded"> in which case you should never get a null List (though you may get an empty list if minOccurs is 0), and you won’t get null values out of the list either. You’ll only have to worry about nulls if you have an @XmlElementWrapper or your schema declares elements as nillable.

    I can’t be more specific without seeing (at least an extract from) your schema and/or generated classes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been provided an XSD and a sample Xml file that contains the
I have been provided with a C++ DLL and associated header file in order
My web designer has provided me with updated fonts/icons that have been added to
Have been trying to encrypt an xml file to a string so that I
We have a desktop application, which has been provided a web UI by hosting
I need to call a web service from my classic ASP website. I have
I have been tasked to send data to a 3rd Party web service, they
I have been provided with an xsd that I compiled to Java classes using
I have been provided with a wcf service url, private and public certificate to
We have been provided with a wsdl and xsd schema by a company we

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.