审查视图

src/main/java/com/sy/bwAnalysis/MessageAnalysis.java 786 字节
1 2 3 4 5 6 7 8 9 10 11
package com.sy.bwAnalysis;

import com.sy.bwAssist.Message;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import com.thoughtworks.xstream.io.xml.XmlFriendlyNameCoder;

public class MessageAnalysis {

    public static Message msg = null;
zhangFan authored
12
    public Message readTicketsXml(String str) {
13 14 15
        return getMessage(str);
    }
zhangFan authored
16 17 18


19 20 21
    static Message getMessage(String str) {
        XStream xstream = new XStream(new DomDriver("UTF-8", new XmlFriendlyNameCoder("_-", "_")));
        xstream.processAnnotations(Message.class);
zhangFan authored
22 23
        msg = (Message) xstream.fromXML(str);
        System.out.println("解析后的Message对象" + msg);
24 25 26
        return msg;
    }
zhangFan authored
27
    public String getStype() {
28 29 30
        return msg.getMeta().getSmType();
    }
}