@Test public void toXmlWithListAsRoot() { User user1 = new User(); user1.setId(1L); user1.setName("calvin"); User user2 = new User(); user2.setId(2L); user2.setName("kate"); List<User> userList = Lists.newArrayList(user1, user2); String xml = XmlMapper.toXml(userList, "userList", User.class, "UTF-8"); System.out.println("Jaxb Object List to Xml result:\n" + xml); }
public static String toXml(Object root) { Class clazz = ClassUtil.unwrapCglib(root); return toXml(root, clazz, null); }
XmlMapper { public static String toXml(Object root) { Class clazz = ClassUtil.unwrapCglib(root); return toXml(root, clazz, null); } }
XmlMapper { public static String toXml(Object root) { Class clazz = ClassUtil.unwrapCglib(root); return toXml(root, clazz, null); }  }
XmlMapper { public static String toXml(Object root) { Class clazz = ClassUtil.unwrapCglib(root); return toXml(root, clazz, null); }  static String toXml(Object root); static String toXml(Object root, String encoding); static String toXml(Object root, Class clazz, String encoding); static String toXml(Collection<?> root, String rootName, Class clazz); static String toXml(Collection<?> root, String rootName, Class clazz, String encoding); static T fromXml(String xml, Class<T> clazz); static Marshaller createMarshaller(Class clazz, String encoding); static Unmarshaller createUnmarshaller(Class clazz); }
XmlMapper { public static String toXml(Object root) { Class clazz = ClassUtil.unwrapCglib(root); return toXml(root, clazz, null); }  static String toXml(Object root); static String toXml(Object root, String encoding); static String toXml(Object root, Class clazz, String encoding); static String toXml(Collection<?> root, String rootName, Class clazz); static String toXml(Collection<?> root, String rootName, Class clazz, String encoding); static T fromXml(String xml, Class<T> clazz); static Marshaller createMarshaller(Class clazz, String encoding); static Unmarshaller createUnmarshaller(Class clazz);  }