This is my XML file:
<fields>
<field mappedField="Num">
</field>
<field mappedField="Type">
</field>
</fields>
I created 2 classes to parse it (Fields.java and Field.java):
@XmlRootElement(name = "fields")
public class Fields {
@XmlElement(name = "field")
List<Field> fields = new ArrayList<Field>();
//getter, setter
}
and
public class Field {
@XmlAttribute(name = "mappedField")
String mappedField;
//getter,setter
}
But I get this exception:
[INFO] com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
[INFO] at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66) ~[na:1.6.0_07]
[INFO] at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:422) ~[na:1.6.0_07]
[INFO] at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:270) ~[na:1.6.0_07]
I can't understand why this exception rises. Exception is here:
JAXBContext context = JAXBContext.newInstance(Fields.class);
I use JDK 1.6_0.0.7. Thanks.