Very easy to solve issue with SimpleXML. What i'm doing wrong?

后端 未结 2 835
死守一世寂寞
死守一世寂寞 2021-02-04 16:29

I\'m working with Java and SimpleXML

I need to parse this XML file with SimpleXML:


    

        
2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-04 17:08

    You must put required=false on the ArrayList of areas, some of the Pages of the XML doesn't have Areas

        @Root
    public class Page {
        @Attribute
        String src;
        @Attribute
        String id;
        @Attribute
        String thumbnail;
        @ElementList (required=false)
        public ArrayList areas;
    }
    

提交回复
热议问题