Underscore-java can construct XML string with help of a builder.
class Customer {
String name;
int age;
int id;
}
Customer customer = new Customer();
customer.name = "John";
customer.age = 30;
customer.id = 12345;
String xml = U.objectBuilder().add("customer", U.objectBuilder()
.add("name", customer.name)
.add("age", customer.age)
.add("id", customer.id)).toXml();
// <?xml version="1.0" encoding="UTF-8"?>
// <customer>
// <name>John</name>
// <age number="true">30</age>
// <id number="true">12345</id>
// </customer>