What about using:
@XmlElement(name = "name")
private String _name;
And class annotation:
@XmlRootElement(name = "contact")
@XmlAccessorType(value = XmlAccessType.NONE)
public class C360Contact {
-----Original Message-----
From: Kessel, Christopher [mailto:[email protected]]
Sent: den 12 november 2009 19:29
To: [email protected]
Subject: @XmlValue complaining about non existent @XmlElement
I've got a really simple data class.
public class C360Contact
{
@XmlValue
private String _name;
public String getName()
{
return _name;
}
public void setName( String name )
{
_name = name;
}
}
I'm trying to indicate the value for the "name" attribute is in the
content of the tag rather than a tag on its own. E.g.
<contact>Jim</contact>
vs.
<contact>
<name>Jim</name>
</contact>
However, I get the following error when publishing the endpoint. Any
idea why?
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1
counts of IllegalAnnotationExceptions
If a class has @XmlElement property, it cannot have @XmlValue property.
this problem is related to the following location:
at private java.lang.String
com.transunion.cis.iq411.soap.C360Contact._name
at com.transunion.cis.iq411.soap.C360Contact
at public com.transunion.cis.iq411.soap.C360Contact
com.transunion.cis.iq411.soap.C360Request.getContact()
at com.transunion.cis.iq411.soap.C360Request
this problem is related to the following location:
at public java.lang.String
com.transunion.cis.iq411.soap.C360Contact.getName()
at com.transunion.cis.iq411.soap.C360Contact
at public com.transunion.cis.iq411.soap.C360Contact
com.transunion.cis.iq411.soap.C360Request.getContact()
at com.transunion.cis.iq411.soap.C360Request