public static String XMLTOJSON(String XMLContent,String tag)
{
XMLSerializer xmlSerializer = new XMLSerializer();
JSON json = xmlSerializer.read(XMLContent);
JSONObject obj = JSONObject.fromObject(json);
JSONObject jobj = obj.getJSONObject(tag);
}
注意:取得的jobj不一定是符合json可以简单的处理,当然下面不通用
JSONArray arr = null;
if(jobj.isArray()){
arr = jobj.getJSONArray("subOrderInfoList");
}else{
JSONObject obj0 = jobj.getJSONObject("subOrderInfoList");
arr = JSONArray.fromObject(obj0);
}
原文地址:http://www.cnblogs.com/qiyongliang/p/3817079.html