JAXB2: Mapping nested elements into the same Java class

后端 未结 2 1190
温柔的废话
温柔的废话 2021-01-18 22:02

I\'m having trouble trying to map nested elements into the same Java class.

XML

What I\'m trying to do here is to set id attrib

2条回答
  •  北海茫月
    2021-01-18 22:45

    Add a new class Layout:

    public class SlideText extends Slide {
        @XmlElement
        private Layout layout;
    }
    
    public class Layout {
        @XmlAttribute
        private String  text;
    }
    

提交回复
热议问题