本文整理了Java中org.json.XML.toString()
方法的一些代码示例,展示了XML.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XML.toString()
方法的具体详情如下:
包路径:org.json.XML
类名称:XML
方法名:toString
[英]Convert a JSONObject into a well-formed, element-normal XML string.
[中]
代码示例来源:origin: loklak/loklak_server
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
*
* @param object
* A JSONObject.
* @return A string.
* @throws JSONException Thrown if there is an error parsing the string
*/
public static String toString(Object object) throws JSONException {
return toString(object, null);
}
代码示例来源:origin: h2oai/h2o-2
public String toXml() {
JsonObject jo = this.toJson();
String jsonString = jo.toString();
org.json.JSONObject jo2 = new org.json.JSONObject(jsonString);
String xmlString = org.json.XML.toString(jo2);
return xmlString;
}
代码示例来源:origin: loklak/loklak_server
sb.append(key);
sb.append('>');
sb.append(toString(val));
sb.append("</");
sb.append(key);
sb.append('>');
} else {
sb.append(toString(val, key));
sb.append(toString(value, key));
sb.append(toString(val, tagName == null ? "array" : tagName));
代码示例来源:origin: b3log/latke
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
*
* @param object
* A JSONObject.
* @return A string.
* @throws JSONException Thrown if there is an error parsing the string
*/
public static String toString(Object object) throws JSONException {
return toString(object, null);
}
代码示例来源:origin: h2oai/h2o-2
public NanoHTTPD.Response serveResponse(NanoHTTPD server, Properties parms, RequestType type, Response response) {
// Argh - referencing subclass, sorry for that, but it is temporary hack
// for transition between v1 and v2 API
if (this instanceof Request2) ((Request2) this).fillResponseInfo(response);
if (this instanceof Parse2) ((Parse2) this).fillResponseInfo(response); // FIXME: Parser2 should inherit from Request2
if( type == RequestType.json ) {
return response._req == null ? //
wrap(server, response.toJson()) : //
wrap(server, new String(response._req.writeJSON(new AutoBuffer()).buf()), RequestType.json);
}
else if (type == RequestType.xml) {
if (response._req == null) {
String xmlString = response.toXml();
NanoHTTPD.Response r = wrap(server, xmlString, RequestType.xml);
return r;
}
else {
String jsonString = new String(response._req.writeJSON(new AutoBuffer()).buf());
org.json.JSONObject jo2 = new org.json.JSONObject(jsonString);
String xmlString = org.json.XML.toString(jo2);
NanoHTTPD.Response r = wrap(server, xmlString, RequestType.xml);
return r;
}
}
return wrap(server, build(response));
}
代码示例来源:origin: b3log/latke
sb.append(key);
sb.append('>');
sb.append(toString(val));
sb.append("</");
sb.append(key);
sb.append('>');
} else {
sb.append(toString(val, key));
sb.append(toString(value, key));
sb.append(toString(val, tagName == null ? "array" : tagName));
代码示例来源:origin: com.vaadin/vaadin-shared-deps
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param o A JSONObject.
* @return A string.
* @throws JSONException
*/
public static String toString(Object o) throws JSONException {
return toString(o, null);
}
代码示例来源:origin: com.barchart.wrap/barchart-wrap-jackson
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param object A JSONObject.
* @return A string.
* @throws JSONException
*/
public static String toString(Object object) throws JSONException {
return toString(object, null);
}
代码示例来源:origin: jmaki/ajax-wrapper-comp
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param o A JSONObject.
* @return A string.
* @throws JSONException
*/
public static String toString(Object o) throws JSONException {
return toString(o, null);
}
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param o A JSONObject.
* @return A string.
* @throws JSONException If something goes wrong.
*/
public static String toString(Object o) throws JSONException {
return toString(o, null);
}
代码示例来源:origin: org.apache.abdera/json
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param o A JSONObject.
* @return A string.
* @throws JSONException
*/
public static String toString(Object o) throws JSONException {
return toString(o, null);
}
代码示例来源:origin: io.snappydata/gemfire-json
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param object A JSONObject.
* @return A string.
* @throws JSONException
*/
public static String toString(Object object) throws JSONException {
return toString(object, null);
}
代码示例来源:origin: org.datanucleus/datanucleus-api-json
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param o A JSONObject.
* @return A string.
* @throws JSONException
*/
public static String toString(Object o) throws JSONException {
return toString(o, null);
}
代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param o A JSONObject.
* @return A string.
* @throws JSONException
*/
public static String toString(Object o) throws JSONException {
return toString(o, null);
}
代码示例来源:origin: com.unboundid.components/json
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param object A JSONObject.
* @return A string.
* @throws JSONException
*/
public static String toString(Object object) throws JSONException {
return toString(object, null);
}
代码示例来源:origin: io.snappydata/gemfire-util
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param object A JSONObject.
* @return A string.
* @throws JSONException
*/
public static String toString(Object object) throws JSONException {
return toString(object, null);
}
代码示例来源:origin: com.xmlcalabash/xmlcalabash
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param o A JSONObject.
* @return A string.
* @throws JSONException If something goes wrong.
*/
public static String toString(Object o) throws JSONException {
return toString(o, null);
}
代码示例来源:origin: fernandospr/javapns-jdk16
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param o A JSONObject.
* @return A string.
* @throws JSONException
*/
public static String toString(Object o) throws JSONException {
return toString(o, null);
}
代码示例来源:origin: org.codeartisans/org.json
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
*
* @param object
* A JSONObject.
* @return A string.
* @throws JSONException Thrown if there is an error parsing the string
*/
public static String toString(Object object) throws JSONException {
return toString(object, null);
}
代码示例来源:origin: yaoguangluo/DETA_BackEnd
public String MapToXml(Map<String, Object> response){
Gson gson = new Gson();
String json = gson.toJson(response);
JSONObject jsonObj = new JSONObject(json);
String xml = XML.toString(jsonObj);
return xml;
}
内容来源于网络,如有侵权,请联系作者删除!