Hi,
I am having problems unmarshalling the XML below. I think the problem is
with mapping the collection with a compound location attribute on the
bind-xml element. The mapping file I have created (below) will marshall
my Java object correctly, but the reverse (unmarshalling) does not work.
The error I get is:
java.lang.IllegalStateException: Java schema change: Class
GenericHolidayDealDetail$Image can no longer be constructed:
GenericHolidayDealDetail$Image
I have tried many different mapping configurations to get to this point
and I cannot see what else I can try. Any suggestions?
Input XML:
<topasXML>
<response>
<offer UID="1234">
<property>
<images>
<image key="pic1">pic1.jpg</image>
<image key="pic2">pic2.jpg</image>
</images>
</property>
</offer>
</response>
</topasXML>
The Java class:
public class GenericHolidayDealDetail {
private String id;
private List<Image> imageUrls;
//getters and setters...
//inner class
public class Image {
private String url;
private String title;
public Image(String url, String title) {
this.url = url;
this.title = title;
}
//getters and setters...
}
}
Mapping file:
<mapping>
<class name="GenericHolidayDealDetail">
<map-to xml="topasXML" />
<field name="id">
<bind-xml name="UID" node="attribute"
location="response/offer" />
</field>
<field name="imageUrls" type="GenericHolidayDealDetail$Image"
collection="arraylist" >
<bind-xml name="image" node="element"
location="response/offer/property/images"/>
</field>
</class>
<class name="GenericHolidayDealDetail$Image"
verify-constructable="false">
<map-to xml="image"/>
<field name="url">
<bind-xml node="text" />
</field>
<field name="title">
<bind-xml name="key" node="attribute" />
</field>
</class>
</mapping>
Thanks,
Ian
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email