import com.ruiyun.gui.store.haikang.haikang.bean.FCSearchDescription;
import com.ruiyun.gui.store.haikang.haikang.bean.FDSearchDescription;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
public class ObjToXmlUtil {
public static String toXml(Object obj) {
XStream xstream = new XStream(new DomDriver("utf8"));
StringBuilder builder = new StringBuilder();
if(FDSearchDescription.class.isInstance(obj)){
xstream.alias("FDSearchDescription", FDSearchDescription.class);
String xml = xstream.toXML(obj);
builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
builder.append(xml);
}else if (FCSearchDescription.class.isInstance(obj)){
xstream.alias("FCSearchDescription", FCSearchDescription.class);
String xml = xstream.toXML(obj);
builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
builder.append(xml);
}
return builder.toString();
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)