将Java bean转换为Xml
/* 来 自 时 代 J a v a 公 众 号*/ //package com.nowjava; import java.beans.XMLEncoder; import java.io.*; public class Main { public static void main(String[] argv) throws Exception { Object bean = "nowjava.com"; System.out.println(beanToXml(bean)); } public static String beanToXml(Object bean) { ByteArrayOutputStream os = new ByteArrayOutputStream(16384); try (XMLEncoder e = new XMLEncoder(os)) { /** from