package app
import net.sf.json.JSON;
import net.sf.json.JSONSerializer;
import net.sf.json.xml.XMLSerializer;
public class ConvertJSONtoXMLOSB {
public static String getConvertJSONtoXML(String one) throws Exception {
JSON json = JSONSerializer.toJSON( one );
XMLSerializer xmlSerializer = new XMLSerializer();
xmlSerializer.setTypeHintsEnabled( false );
xmlSerializer.setRootName( "GetGeocodeResponse" );
xmlSerializer.setElementName( "geoname" );
String xml = xmlSerializer.write(json);
System.out.println(xml);
return xml;
}
}
import net.sf.json.JSON;
import net.sf.json.JSONSerializer;
import net.sf.json.xml.XMLSerializer;
public class ConvertJSONtoXMLOSB {
public static String getConvertJSONtoXML(String one) throws Exception {
JSON json = JSONSerializer.toJSON( one );
XMLSerializer xmlSerializer = new XMLSerializer();
xmlSerializer.setTypeHintsEnabled( false );
xmlSerializer.setRootName( "GetGeocodeResponse" );
xmlSerializer.setElementName( "geoname" );
String xml = xmlSerializer.write(json);
System.out.println(xml);
return xml;
}
}
No comments:
Post a Comment