Loading

微信回复图文消息

微信回复图文消息

一级POJO只能包含一级子元素,如果是多级子元素,就包含多级对象就可以了;

@XmlRootElement(name="xml")
@XmlAccessorType(XmlAccessType.FIELD)
public class ScanUrl {
    private Integer id;

    @XmlElement(name="ToUserName")
    private String toUserName;

    @XmlElement(name="FromUserName") 
    private String fromUserName;

    @XmlElement(name="CreateTime") 
    private Integer createTime;

    @XmlElement(name="MsgType") 
    private String msgType;

    @XmlElement(name="ArticleCount")
    private Integer articleCount;
    
    @XmlElement(name="Articles", type=ScanUrlItemOuter.class)
    private ScanUrlItemOuter scanUrlItemOuter;

 

@XmlRootElement(name="Articles")
@XmlAccessorType(XmlAccessType.FIELD)
public class ScanUrlItemOuter {

    @XmlElement(name = "item", type = ScanUrlItem.class)
    private List<ScanUrlItem> scanUrlItems;

 

@XmlRootElement(name="item")
@XmlAccessorType(XmlAccessType.FIELD)
public class ScanUrlItem {

    @XmlElement(name="Title")
    private String title;

    @XmlElement(name="Description") 
    private String description;

    @XmlElement(name="PicUrl") 
    private String picUrl;

    @XmlElement(name="Url")
    private String url;

清爽.

posted @ 2017-04-22 07:12  stono  阅读(307)  评论(0编辑  收藏  举报