import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import java.io.IOException;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class XStreamExampleApplication {
public static void main(String[] args)
throws IOException
{
XStream xStream = new XStream(new DomDriver());
xStream.allowTypes(new Class[] { Employee.class });
xStream.alias("employee", Employee.class);
Employee e1 = new Employee("Sanyog", "Gautam", 1000,
19, "Male");
String xml
= xStream.toXML(e1);
Employee employee = (Employee)xStream.fromXML(xml);
System.out.println("First name of Employee: "
+ employee.getFirstName());
System.out.println("Last name of Employee: "
+ employee.getLastName());
System.out.println("Employee's age: "
+ employee.getAge());
System.out.println("Employee's gender: "
+ employee.getGender());
System.out.println("Employee's salary: $"
+ employee.getSalary());
}
}