Xstream解析报文

xs.autodetectAnnotations(true);

 /**
     * xml解析函数
     * @param String xml信息
     * @return String 接口返回信息
     */
    public static Object toObject(String xml,Class mainclass){
        XStream xs = new XStream(new DomDriver());
        xs.autodetectAnnotations(true);
        xs.processAnnotations(mainclass);
        Object obj= xs.fromXML(xml);
        return obj;
    }

 

posted on 2014-11-02 15:37  涤生-三省吾身  阅读(357)  评论(0编辑  收藏  举报

导航