Class XmlStream


  • public final class XmlStream
    extends Object
    XML 处理
    Since:
    JDK 1.6
    Author:
    jinyu(foxinmy@gmail.com)
    • Constructor Detail

      • XmlStream

        public XmlStream()
    • Method Detail

      • fromXML

        public static <T> T fromXML​(InputStream content,
                                    Class<T> clazz)
        Xml2Bean
        Parameters:
        content - xml内容
        clazz - bean类型
        Returns:
      • fromXML

        public static <T> T fromXML​(String content,
                                    Class<T> clazz)
        Xml2Bean
        Parameters:
        content - xml内容
        clazz - bean类型
        Returns:
      • map2xml

        public static String map2xml​(Map<String,​String> map)
        map2xml
        Parameters:
        map - value无嵌套的map
        Returns:
        xml内容
      • map2xml

        public static String map2xml​(com.alibaba.fastjson.JSONObject json)
        map2xml
        Parameters:
        json - value无嵌套的json
        Returns:
        xml内容
      • xml2map

        public static Map<String,​String> xml2map​(String content)
        xml2map
        Parameters:
        content - 无嵌套节点的xml内容
        Returns:
        map对象
      • toXML

        public static String toXML​(Object object)
        Bean2Xml
        Parameters:
        object - bean对象
        Returns:
        xml内容
      • toXML

        public static <T> void toXML​(T t,
                                     OutputStream os)
        Bean2Xml
        Parameters:
        t - bean对象
        os - 输出流