How to unmarshall repeated nested classes with JAXB?

前端 未结 4 1895
故里飘歌
故里飘歌 2020-12-31 11:33

How can I instruct JAXB to process this ?

XML


 
    
          


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-31 11:49

    You could try to use the XmlElementWrapper annotation but I am not sure how it should work with multiple wrapper nodes:

    @XmlRootElement
    public class Root {
       @XmlElementWrapper(name="parent")
       @XmlElement(name="child")
       List allChildren;
    }
    

提交回复
热议问题