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 ei
You could add a package level annotation (this is done on a class called package-info) and specify elementFormDefault="qualified", then you wouldn't need to qualify each @XmlElement annotation.
@javax.xml.bind.annotation.XmlSchema(
namespace="http://convio.com/crm/v1.0".
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package com.convio.crm;
For more information on JAXB and namespaces see:
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.