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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:00:48+00:00 2026-05-22T12:00:48+00:00

hi all I am trying to represent the following xml code: <AggregationMeta> <AggregationLink> <LocalName>stuff</LocalName>

  • 0

hi all
I am trying to represent the following xml code:

        <AggregationMeta>
            <AggregationLink>
                <LocalName>stuff</LocalName>
                <Value>stuff</Value>
                <Meta/>
            </AggregationLink>
            <AggregationLink>
                <LocalName>stuff</LocalName>
                <Value>stuff</Value>
                <Meta/>
            </AggregationLink>
        </AggregationMeta>

and I want to do this using @XmlElementWrapper annotation.

here’s the class where I use it:

public class VrIdnMeta {

private String lri;
private String nodeLocalName;
private List<Link> referenceLink;
private List<Link> aggregationLink;
private List<SimpleLink> backLink;
private List<SimpleLink> incomingChangeLink;

...

@XmlElementWrapper(name = "ReferenceMeta")
@XmlElement(name = "ReferenceLink")
public List<Link> getReferenceLink() {
    return referenceLink;
}

public void setReferenceLink(List<Link> referenceLink) {
    this.referenceLink = referenceLink;
}

@XmlElementWrapper(name = "AggregationMeta")
@XmlElement(name = "AggregationLink")
public List<Link> getAggregationLink() {
    return aggregationLink;
}

public void setAggregatioinLink(List<Link> aggregationLink) {
    this.aggregationLink = aggregationLink;
}

@XmlElementWrapper(name = "BackLinkMeta")
@XmlElement(name = "BackLink")
public List<SimpleLink> getBackLink() {
    return backLink;
}

public void setBackLink(List<SimpleLink> backLink) {
    this.backLink = backLink;
}

@XmlElementWrapper(name = "IncomingChangeMeta")
@XmlElement(name = "IncomingChangeLink")
public List<SimpleLink> getIncomingChangeLink() {
    return incomingChangeLink;
}

public void setIncomingChangeLink(List<SimpleLink> incomingChangeLink) {
    this.incomingChangeLink = incomingChangeLink;
}

}

and here’s the SimpleLink class

public class SimpleLink {

private String localName;
private String value;

...

@XmlElement(name = "LocalName")
public String getLocalName() {
    return localName;
}

public void setLocalName(String localName) {
    this.localName = localName;
}

@XmlElement(name = "Value")
public String getValue() {
    return value;
}

public void setValue(String value) {
    this.value = value;
}
}

and finally the Link class

public class Link extends SimpleLink{

private String meta;

public Link(String localName, String value, String meta) {
    super(localName, value);
    this.meta = meta;
}

public Link() {
    super();
}

public Link(String localName, String value) {
    super(localName, value);
}

@XmlElement(name = "Meta")
public String getMeta() {
    return meta;
}

public void setMeta(String meta) {
    this.meta = meta;
}

}

the problem comes when I use Jaxb2 to unmarshal an xml alike to the one I wrote above: I get a NullPointerException :-(.
I read that there is a bug in jaxb about this fact but it was solved in 2006 and I am using spring 3 (with his own jaxb2 library).

Anyone has a clue?

  • 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-22T12:00:49+00:00Added an answer on May 22, 2026 at 12:00 pm

    The NPE seems to stem from the names of your get and set methods not matching up (in VrIdnMeta):

    @XmlElementWrapper(name = "AggregationMeta")
    @XmlElement(name = "AggregationLink")
    public List<Link> getAggregationLink() {
        return aggregationLink;
    }
    
    public void setAggregatioinLink(List<Link> aggregationLink) {
        this.aggregationLink = aggregationLink;
    }
    

    When I changed setAggregatioinLink to setAggregationLink I got your example to run as expected.

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

Sidebar

Related Questions

Hey all i am trying to figiure out why my code is not triggering
I'm writing in C# and trying to represent an XML config file through an
I am trying to expose picassa web album by using Picassa web albums. Following
I'm trying to transform a table to an XML struture and I want one
I'm trying to get the following json (see below) deserialized (using newtonsoft json serializer)
I'm trying to implement cascading controls using the following LINQ query expression. The idea
I want to declare a graph of all states where the edges represent contiguous
I was trying all of yesterday to try and integrate a SQL Database with
I have been trying all afternoon to get the jQuery Sifr Plugin ( http://jquery.thewikies.com/sifr/
I may be way off base, but I've been trying all afternoon to run

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.