怎么将下面的json存储转成xml数据格式存储
private String generateTableInfo(Uri uri, String where, String filename, boolean needIds) {
JSONArray jAResult = new JSONArray();
String ids = "";
Cursor c = mContext.getContentResolver().query(uri, null, where, null, null);
if (c != null) {
try {
if (c.moveToFirst()) {
for (int i = 0; i < c.getCount(); i++) {
c.moveToPosition(i);
JSONObject jsonO = new JSONObject();
int ColumnCount = c.getColumnCount();
for (int j=0; j<ColumnCount; j++) {
if (uri.equals(CaseInfo.CONTENT_URI) && c.getColumnName(j).equals(CaseInfo._PATH)) {
String filepath = c.getString(j);
File file = new File(filepath);
zipFilelist.add(file);
jsonO.put(c.getColumnName(j), file.getName());
} else {
jsonO.put(c.getColumnName(j), c.getString(j));
}
if (needIds && uri.equals(AttachInfo.CONTENT_URI) && c.getColumnName(j).equals(AttachInfo._BYTEID)) {
if (ids.length() == 0) {
ids = "(\'" + c.getString(j);
} else {
ids += "\',\'" + c.getString(j);
}
}
}
jAResult.put(jsonO);
}
if (needIds && uri.equals(AttachInfo.CONTENT_URI)) {
if (ids.length() != 0) {
ids += "\')";
}
}
}
} catch (Exception e) {
// TODO: handle exception
Log.i(e.getMessage());
} finally {
c.close();
}
}