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

后端 未结 2 836
死守一世寂寞
死守一世寂寞 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<Area> areas;
    }
    
    0 讨论(0)
  • 2021-02-04 17:29

    That errors appear when I had errors in XML file (like unended tag). For someone who have the same problem and came to this post.

    0 讨论(0)
提交回复
热议问题