我正在使用SimpleXml来(反)序列化POJOs。现在,我有一个大的XML文件,其中包含一些不需要的元素。例如,对于这个XML:
<Root>
<Element>Used</Element>
<Another>Not used</Another>
<Root>
我想创建一个看起来像这样的POJO:@Root
class Root{
@Element
private String element;
}
问题是我遇到了这个异常:
simpleframework.xml.core.ElementException: Element 'Another' does not have a
match in class blah.blah.Blah at line 1
那么...我该如何配置POJO以便正确解析XML?