我一直在学习这里教程
照现在的情况看,它运作得很好。
但是,如果我试图将类层次结构转换为XML,则会得到异常。
示例:
@XmlRootElement(name = "stuff")
public class Stuff {
    @XmlMixed
    public List<Other> getList(){
      return records;
    }
}其他类别:
@XmlRootElement(name="other")
public class Other {
  @XmlAttribute int foo;
}例外的重要部分是:
class mypackage.Other nor any of its super class is known to this context.发布于 2013-12-02 18:42:36
下面是一个快速的解决办法:
加:
@XmlSeeAlso(Other.class) to Stuff .为了获得更多的见解,您应该查看下面的文章
https://stackoverflow.com/questions/20334956
复制相似问题