How to write my XSD in order to match the desired XML and Java format using JAXB and XJC

> **Possible Duplicate:** > [How generate XMLElementWrapper annotation with xjc and customized binding](https://stackoverflow.com/questions/2447091/how-generate-xmlelementwrapper-annotation-with-xjc-and-customized-binding) I would like to be able to process XML of this format using JAXB ... xx1 yy1 xx2 yy2 I'd like to marshal the above XML into these Java classes (for simplicity, I left modifiers such as `public`, `protected` as well as getters/setters away): class Configuration { List things; } class Thing { String name; String value; } The relevant part of my current XSD structure roughly looks like this: Unfortunately, XJC generates also a class for `Things` even if that is really unnecessary in the Java part of the processing. So my output is this: class Configuration { Things things; } class Things { List thing; } class Thing { String name; String value; } Is there any way I can tell XJC to avoid generating this unnecessary class? Or is there any way I can re-phrase my XSD in order to avoid that generation? Both options would be fine with me. In fact, I guess I would need to generate the `@XmlElementWrapper` annotation as documented here: - https://stackoverflow.com/questions/4047998/mapping-java-collections-which-contains-super-and-sub-types-with-jaxb - https://stackoverflow.com/questions/4863655/jaxb-list-tag-creating-inner-class#4863808

以上就是How to write my XSD in order to match the desired XML and Java format using JAXB and XJC的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏