通过数据生成XML
/**
* 通过数据生成XML
* @param subObj
* @return Object
*/
public static Object toXMLString(Object subObj ){
XStream xStream = new XStream(new DomDriver());//不需要XPP3库
xStream.alias(subObj.getClass().getName(),subObj.getClass());
String xml = xStream.toXML(subObj);
return xml;
}
通过XML生成表的数据
/**
* 通过XML生成表的数据
* @param xmlString
* @return Object
*/
public static Object invokeXMLString(Object xmlString ){
XStream xStream = new XStream(new DomDriver());//不需要XPP3库
return xStream.fromXML(xmlString.toString());
}
XStream
最新推荐文章于 2024-05-26 20:48:22 发布