Android: Object to XML with XStream



I want to serialize object to XML in Android with XStream. But even simple codes crashes.



Person person = new Person();
person.name = "Joe";
XStream xstream = new XStream(new DomDriver());
String xml = xstream.toXML(person);
Log.d("xml", xml);


This is class person:



class Person {

public String name;

}


And problem is that it can't find XStream despite that I download library and place it properly. Other problem is that, when finnaly Eclipse finds XStream I get errors in this lines :



String xml = xstream.toXML(person);

No comments:

Post a Comment