JAXB 编组 - 扩展现有类
我需要使用 JAXB 通过 XML 创建一系列 Java 对象,这些对象都扩展已创建的公共基类(不使用 JAXB)。例如,假设我尝试生成以下 JAXB 类:
Penguin.xml -> Penguin.java
Robin.xml -> Robin.java
Cardinal.xml -> Cardinal.java
我已经有一个名为 Bird.java
的现有基类,我希望扩展上面的三个类。
最好的方法是什么?
感谢您的帮助!
I am in need of creating a series of Java objects via XML using JAXB that all extend a common base class that is already created (not using JAXB). For example, let's say I have following JAXB classes that I am trying to generate:
Penguin.xml -> Penguin.java
Robin.xml -> Robin.java
Cardinal.xml -> Cardinal.java
I already have an existing base class called Bird.java
that I wish the three classes above to extend.
What is the best way to do this?
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这非常简单:您需要创建一个包含以下内容的 JAXB 绑定文件:
有关此选项(以及其他甜蜜的东西)的更多信息,您可以找到 此处。
That is very simple: you need to to create a JAXB binding file with following contents:
More information on this option (and other sweet things) you can find here.