//XStream xstream = new XStream(new DomDriver()); // does not require XPP3 library
//XStream xstream = new XStream(new StaxDriver()); // does not require XPP3 library starting with Java 6
xstream.processAnnotations(Person.class);
Person joe = new Person("Joe", "Walnes");
joe.setPhone(new PhoneNumber(123, "1234-456"));
joe.setFax(new PhoneNumber(123, "9999-999"));
String xml = xstream.toXML(joe);
System.out.println(xml);
}