All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.arccode.wechat.pay.api.common.util.MapUtils Maven / Gradle / Ivy

The newest version!
package net.arccode.wechat.pay.api.common.util;

import net.arccode.wechat.pay.api.common.exception.WXPayApiException;
import org.w3c.dom.Element;

import java.util.Map;

/**
 * map 相关工具
 *
 * @author http://arccode.net
 * @since 2015-11-05
 */
public class MapUtils {

    /**
     * map转xml element
     *
     * @param map
     * @return
     */
    public static String map2XmlString(Map map) throws WXPayApiException {
        Element root = XmlUtils.createRootElement("xml");
        for (String key : map.keySet()) {
            XmlUtils.appendCDATAElement(root, key, map.get(key));
        }

        return XmlUtils.nodeToString(root);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy