Serializing to XML using XStream but not getting all fields

divorcing

New Member
I have a class called \[code\]Lookup\[/code\] that has two properties:\[code\]public class Lookup { private String surveyName; private String GUID; public Lookup(String name, String guid){ this.surveyName = name; this.GUID = guid; }}\[/code\]In another class, I have a list of \[code\]Lookup\[/code\] that I am trying to serialize and save to file. This is how I'm doing it:\[code\]List<Lookup> lookup = new ArrayList<Lookup>();lookup.add(new Lookup("foo","bar"));XStream serializer = new XStream();serializer.alias("Lookups",List.class);String xml = serializer.toXML(lookup);\[/code\]The XML I end up with is:\[code\]<Lookups> <Lookup> <GUID>bar</GUID> </Lookup></Lookups>\[/code\]As you can see, it only serialized the field \[code\]GUID\[/code\] but not the field \[code\]surveyName\[/code\]. Why is it ignoring that field?
 
Back
Top