Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
 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));
 }
Esempio n. 4
0
 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));
 }