JAXB:注释类型XmlElement的属性名称未定义

时间:2014-04-14 23:58:47

标签: java xml jaxb

当我尝试为JAXB分配name的{​​{1}}属性时,我在Eclipse中收到错误:

XmlElement

我的模型类示例:

The attribute name is undefined for the annotation type XmlElement

我正在尝试使用this answer

1 个答案:

答案 0 :(得分:7)

好吧,事实证明这是一个愚蠢的错误。我正在导入

import com.sun.xml.internal.txw2.annotation.XmlElement;

而不是

import javax.xml.bind.annotation.XmlElement;
相关问题