Good day team,
I'm having strange problem with marshaling/unmarshaling objects.
My small structure:
<data>
<aclog>
<index>index</index>
<id>id</id>
<date>date</date>
<desc>desc</desc>
</aclog>
<aclog>
<index>index</index>
<id>id</id>
<date>date</date>
<desc>desc</desc>
</aclog>
</data>
Here is small of code:
XStream xstream = new XStream(new DomDriver());
xstream.addImplicitCollection(CctldListActivities.class, "aclog");
xstream.alias("data", CctldListActivities.class);
xstream.alias("aclog", CctldAction.class);
CctldListActivities lcat = new CctldListActivities();
lcat.add(new CctldAction("date","index","desc","id"));
lcat.add(new CctldAction("date","index","desc","id"));
//marshaling is Ok!
LoggerFactory.getLogger(getClass()).debug(xstream.toXML(lcat));
String xml = xstream.toXML(lcat);
// and here is an exception:
CctldListActivities lcat2 = (CctldListActivities)
xstream.fromXML(xml);
Exception text:
---- Debugging information ----
message : index : index
cause-exception :
com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message : index : index
class : uz.webname.web.cctld.CctldListActivities
required-type : java.lang.Object
path : /data/aclog/index
-------------------------------
Objects are very easy and small:
public class CctldListActivities {
private List<CctldAction> aclog = new ArrayList<CctldAction>();
private String rcode;
public CctldListActivities () {
aclog = new ArrayList<CctldAction>();
}
public void add(CctldAction cat) {
aclog.add(cat);
}
// other getters/setters
}
public class CctldAction {
private String index, id, date, desc;
public CctldAction(String date, String index, String desc, String id) {
this.index = index;
this.date = date;
this.desc = desc;
this.id = id;
}
// other getters/setters
}
Could anybody suggest me anything?
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email