作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想要这样的 XML:
<simple>Foo</simple>
@XmlRootElement(name="simple")
class Simple {
@XmlValue
public String contents;
}
@XmlRootElement(name="simple")
class Simple extends OtherClass {
@XmlValue
public String contents;
}
@XmlValue is not allowed on a class that derives another class.
我不能轻易地重构父类(super class)(因为我们在包装类上使用 @XmlElementRef 的方式)。是否有一种解决方法可以让我注释我的子类以生成那个简单的 XML?
最佳答案
接受的答案对我不起作用。
一切都很好,但我还需要将 @XmlTransient 添加到父类(super class)
关于jaxb - 如何在子类上使用 JAXB @XmlValue?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8098274/
我是一名优秀的程序员,十分优秀!