【支付专区】之微信支付构建请求参数xml

/**
* <p>Desc:weChat构建请求参数</p>
* <p>参数名ASCII码从小到大排序(字典序)</p>
* @param params
* @return
*/
public static String buildBodyXml(Map<String,Object> params){
SortedMap<String,Object> sort=new TreeMap<String,Object>(params);
Set<String> keySet = sort.keySet();
StringBuilder sb = new StringBuilder("<xml>");
for (Object key : keySet) {
sb.append(String.format("<%s>%s</%s>", key, params.get(key), key));
}
sb.append("</xml>");
return sb.toString();
}
上一篇:mysql存储过程双重循环示例


下一篇:iOS开源JSON解析库MJExtension