With your current mapping JAXB is expecting the following XML:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<DataTypes>
<types name="type_integer" type="integer" />
<types name="valid_string" type="string" />
</DataTypes>
You just need to do the following in the DataTypes
class to specify the Type
element should be used instead of the default types
which was derived from the property name.
@XmlElement(name="Type")
public List<DataType> getTypes() {
return types;
}
Additional information can be found on my blog:
About @XmlElementWrapper
@XmlElementWrapper
is used to add a grouping element around elements representing items in a collection. If you would like to learn more about what it can do check out the following on my blog: