是panda呀
2017-09-05 16:31
TextMassage导入后public static String textMessageToXml(TextMessage textMessage)一直报错TextMessage cannot be resolved to a type 是什么原因
package panda.util; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.io.SAXReader; import panda.po.TextMessage; import com.thoughtworks.xstream.XStream; //进行消息的格式转换 public class MessageUtil { /** * xml转为map集合 * @param request * @return * @throws DocumentException * @throws IOException */ public static Map<String, String> xmlToMap(HttpServletRequest request) throws DocumentException, IOException{ Map<String, String> map = new HashMap<String, String>(); SAXReader reader = new SAXReader(); InputStream ins = request.getInputStream();//从request中获取输入流 Document doc = reader.read(ins); Element root = doc.getRootElement(); List<Element> list = root.elements(); for(Element e:list){ map.put(e.getName(), e.getText()); } ins.close(); return map; } /** * 将文本消息对象转换为xml * @param textMessage * @return */ //讲将对象类型转为xml类型 public static String textMessageToXml(TextMessage textMessage){ XStream xstream = new XStream(); return xstream.toXML(textMessage); } }
TextMessage不能解决一个类型
初识Java微信公众号开发
158335 学习 · 469 问题
相似问题