public static void object2xmlWithRootElement() { Token token = new Token(); token.setAccessToken("accessToken"); token.setExpiresIn(12); token.setTime(13l); String content = XmlStream.toXML(token); System.err.println(content); }
public static void xml2map() { String content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml><name><![CDATA[weixin4j]]></name><year><![CDATA[2015]]></year></xml>"; System.err.println(XmlStream.xml2map(content)); }
public static void map2xml() { Map<String, String> map = new HashMap<String, String>(); map.put("name", "weixin4j"); map.put("year", "2015"); System.err.println(XmlStream.map2xml(map)); }
public static void object2xmlWithoutRootElement() { String content = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><xml><accessToken>accessToken</accessToken><expiresIn>12</expiresIn><time>13</time></xml>"; System.err.println(XmlStream.fromXML(content, Token.class)); }