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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:20:24+00:00 2026-05-15T11:20:24+00:00

I’m trying to unmarshal a simple xml document from a public api from Convio.

  • 0

I’m trying to unmarshal a simple xml document from a public api from Convio. I’m not getting any compiler errors with the following code, but it won’t produce a result either. The values are null. If I remove the schema and namespace items from the xml document and remove the namespace attribute from the POJO then it will run just fine. What am I missing to be able to work with the xsd document / namespace?

XML example that I’m trying to parse

<?xml version='1.0' encoding='UTF-8'?>
<getSingleSignOnTokenResponse xsi:schemaLocation="http://convio.com/crm/v1.0 http://service.convio.net/xmlschema/crm.public.v1.xsd" xmlns="http://convio.com/crm/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <token>abcdefghijklmnopqrstuvwxyz</token>
  <cons_id>0123456789</cons_id>
</getSingleSignOnTokenResponse>

And the POJO with annotations:

@XmlRootElement(name = "getSingleSignOnTokenResponse", namespace = "http://convio.com/crm/v1.0")
public class SingleSignOnResponseBean
{
  @XmlElement(name = "token")
  public String token;
  @XmlElement(name = "cons_id")
  public int consId;
}

Now, I’m using Jersey to do the actual work, but since I couldn’t get it to unmarshal using Jersey, I set up an unmarshaller by hand using a static xml file on my machine of the XML result above:

    JAXBContext jc = JAXBContext.newInstance(new Class[] {org.orgname.utility.convio.sso.api.SingleSignOnResponseBean.class});
    Unmarshaller u = jc.createUnmarshaller();
    SingleSignOnResponseBean bean2 = (SingleSignOnResponseBean) u.unmarshal(new File("C:/token.xml"));
    System.out.println(bean2.token);

This is probably very simple and I’m just not seeing it on why it won’t work if the schema and namespace elements are defined. I’ve seen some other comments about setting up some sort of SAX filter to strip out the namespace, but since I’m coming in via a REST call from jersey directly I don’t believe I have the opportunity to do that. Any ideas?

  • 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-15T11:20:24+00:00Added an answer on May 15, 2026 at 11:20 am

    The namespace is not “inherited” by the fields on the bound class. You need to define the namespace on the fields as well:

    @XmlRootElement(name = "getSingleSignOnTokenResponse", namespace = "http://convio.com/crm/v1.0")
    public class SingleSignOnResponseBean
    {
      @XmlElement(name = "token", namespace = "http://convio.com/crm/v1.0")
      public String token;
      @XmlElement(name = "cons_id", namespace = "http://convio.com/crm/v1.0")
      public int consId;
    }
    

    If you omit them, then the fields go back to the “default” namespace (i.e. no namespace).

    It’s mildly irritating, but that’s the way it is.

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

Sidebar

Ask A Question

Stats

  • Questions 443k
  • Answers 443k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Neither one will be "faster" to render than the other… May 15, 2026 at 6:22 pm
  • Editorial Team
    Editorial Team added an answer Like this: routes.MapRoute( "Article", "Article/{id}", new { controller = "article",… May 15, 2026 at 6:22 pm
  • Editorial Team
    Editorial Team added an answer Here's some code based on yours: let GetMaxNode (x:_[]) idx… May 15, 2026 at 6:22 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.