SimpleXML:元素'链接'已被使用

时间:2013-08-02 18:32:34

标签: java android xml deserialization simple-framework

你好,抱歉我的英语不好。 看看我试图解析的XML:

<author>
<name>Name</name>
<y:link href="http://api-yaru.yandex.ru/person/20623655/" rel="self"/>
<y:link href="http://upics.yandex.net/20623655/normal" rel="userpic"/>
</author>

SimpleXML代码如下所示:

public class Author_feed {
@Element
private String name;

@ElementList(inline = true)
@Namespace (prefix = "y")
private List<Link_feed> link;
}

Hovewer我看到一个错误:

  

元素&#39;链接&#39;已被使用... [并指向第二个&#34;链接&#34;线]

我该怎么办?

1 个答案:

答案 0 :(得分:3)

我找到了这个链接Android, org.simpleframework.xml Persistence Exception, Element 'foo' is already used

尝试使用@ElementList(entry="link", inline=true)

另一个可能有帮助的参考是Annotation Type ElementList