@Test public void testGetRecents() { AppMsgInfo info = handler.decode(); Assert.assertEquals("南京abc.xlsx", info.title); System.out.println(info); WechatMessage m = from("appmsg-publisher.xml"); handler = new AppMsgXmlHandler(m); info = handler.decode(); Assert.assertEquals("谷歌开发者", info.appName); System.out.println(info); }
public AppMsgInfo decode() { AppMsgInfo info = new AppMsgInfo(); try { Element node = root.element("appmsg"); info.appId = node.attributeValue("appid"); info.title = node.elementTextTrim("title"); info.desc = node.elementTextTrim("des"); String showType = node.elementTextTrim("showtype"); String type = node.elementTextTrim("type"); info.msgType = StringUtils.getInt(type, 0); info.showType = StringUtils.getInt(showType, 0); info.url = node.elementTextTrim("url"); if (info.url != null) { info.url = EncodeUtils.decodeXml(info.url); } node = root.element("appinfo"); info.appName = node.elementTextTrim("appname"); if (message != null) { message.AppMsgInfo = info; } } catch (Exception e) { return null; } return info; }
AppMsgXmlHandler extends AbstractMsgXmlHandler { public AppMsgInfo decode() { AppMsgInfo info = new AppMsgInfo(); try { Element node = root.element("appmsg"); info.appId = node.attributeValue("appid"); info.title = node.elementTextTrim("title"); info.desc = node.elementTextTrim("des"); String showType = node.elementTextTrim("showtype"); String type = node.elementTextTrim("type"); info.msgType = StringUtils.getInt(type, 0); info.showType = StringUtils.getInt(showType, 0); info.url = node.elementTextTrim("url"); if (info.url != null) { info.url = EncodeUtils.decodeXml(info.url); } node = root.element("appinfo"); info.appName = node.elementTextTrim("appname"); if (message != null) { message.AppMsgInfo = info; } } catch (Exception e) { return null; } return info; } }
AppMsgXmlHandler extends AbstractMsgXmlHandler { public AppMsgInfo decode() { AppMsgInfo info = new AppMsgInfo(); try { Element node = root.element("appmsg"); info.appId = node.attributeValue("appid"); info.title = node.elementTextTrim("title"); info.desc = node.elementTextTrim("des"); String showType = node.elementTextTrim("showtype"); String type = node.elementTextTrim("type"); info.msgType = StringUtils.getInt(type, 0); info.showType = StringUtils.getInt(showType, 0); info.url = node.elementTextTrim("url"); if (info.url != null) { info.url = EncodeUtils.decodeXml(info.url); } node = root.element("appinfo"); info.appName = node.elementTextTrim("appname"); if (message != null) { message.AppMsgInfo = info; } } catch (Exception e) { return null; } return info; } AppMsgXmlHandler();  AppMsgXmlHandler(WechatMessage m); }
AppMsgXmlHandler extends AbstractMsgXmlHandler { public AppMsgInfo decode() { AppMsgInfo info = new AppMsgInfo(); try { Element node = root.element("appmsg"); info.appId = node.attributeValue("appid"); info.title = node.elementTextTrim("title"); info.desc = node.elementTextTrim("des"); String showType = node.elementTextTrim("showtype"); String type = node.elementTextTrim("type"); info.msgType = StringUtils.getInt(type, 0); info.showType = StringUtils.getInt(showType, 0); info.url = node.elementTextTrim("url"); if (info.url != null) { info.url = EncodeUtils.decodeXml(info.url); } node = root.element("appinfo"); info.appName = node.elementTextTrim("appname"); if (message != null) { message.AppMsgInfo = info; } } catch (Exception e) { return null; } return info; } AppMsgXmlHandler();  AppMsgXmlHandler(WechatMessage m); String encode(File file, String mediaId); AppMsgInfo decode(); String getHtml(String link); }
AppMsgXmlHandler extends AbstractMsgXmlHandler { public AppMsgInfo decode() { AppMsgInfo info = new AppMsgInfo(); try { Element node = root.element("appmsg"); info.appId = node.attributeValue("appid"); info.title = node.elementTextTrim("title"); info.desc = node.elementTextTrim("des"); String showType = node.elementTextTrim("showtype"); String type = node.elementTextTrim("type"); info.msgType = StringUtils.getInt(type, 0); info.showType = StringUtils.getInt(showType, 0); info.url = node.elementTextTrim("url"); if (info.url != null) { info.url = EncodeUtils.decodeXml(info.url); } node = root.element("appinfo"); info.appName = node.elementTextTrim("appname"); if (message != null) { message.AppMsgInfo = info; } } catch (Exception e) { return null; } return info; } AppMsgXmlHandler();  AppMsgXmlHandler(WechatMessage m); String encode(File file, String mediaId); AppMsgInfo decode(); String getHtml(String link);  }