result = ServiceUtils.invoke("component:oa-infoPortal/PortalServiceInvoker","getTodoNumForBpm", params);
//json数据转换为xml格式
String str=JSON.toJSONString(result.getResult());
JSONArray jsonArray =JSONArray.parseArray(str);
StringBuffer sBuffer=new StringBuffer();
sBuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
sBuffer.append("<![CDATA[");
sBuffer.append("<taskList>");
for (int i = 0; i < jsonArray.size(); i++) {
String str1=jsonArray.get(i).toString();
JSONObject jsStr=JSONObject.parseObject(str1);
sBuffer.append("<task>");
sBuffer.append("<id>");
sBuffer.append(jsStr.get("id"));
sBuffer.append("</id>");
sBuffer.append("<subject>");
sBuffer.append(jsStr.get("subject"));
sBuffer.append("</subject>");
sBuffer.append("<time>");
sBuffer.append(jsStr.get("starttime"));
sBuffer.append("</time>");
sBuffer.append("</task>");
}
sBuffer.append("</taskList>");
sBuffer.append("]]>");
//return JSON.toJSONString(result.getResult());
return sBuffer.toString();
//json数据转换为xml格式
String str=JSON.toJSONString(result.getResult());
JSONArray jsonArray =JSONArray.parseArray(str);
StringBuffer sBuffer=new StringBuffer();
sBuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
sBuffer.append("<![CDATA[");
sBuffer.append("<taskList>");
for (int i = 0; i < jsonArray.size(); i++) {
String str1=jsonArray.get(i).toString();
JSONObject jsStr=JSONObject.parseObject(str1);
sBuffer.append("<task>");
sBuffer.append("<id>");
sBuffer.append(jsStr.get("id"));
sBuffer.append("</id>");
sBuffer.append("<subject>");
sBuffer.append(jsStr.get("subject"));
sBuffer.append("</subject>");
sBuffer.append("<time>");
sBuffer.append(jsStr.get("starttime"));
sBuffer.append("</time>");
sBuffer.append("</task>");
}
sBuffer.append("</taskList>");
sBuffer.append("]]>");
//return JSON.toJSONString(result.getResult());
return sBuffer.toString();