SimpleXML: Element 'link' is already used

余生长醉 提交于 2019-12-11 12:33:40

问题


Hello and sorry for my bad English. Look at the XML I'm trying to parse:

<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>

And SimpleXML code looks like:

public class Author_feed {
@Element
private String name;

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

Hovewer I see an error:

Element 'link' is already used...[and points to the second "link" line]

What shall I do?


回答1:


I have found this link Android, org.simpleframework.xml Persistence Exception, Element 'foo' is already used

try using @ElementList(entry="link", inline=true)

Another reference that might be helpful is Annotation Type ElementList



来源:https://stackoverflow.com/questions/18023830/simplexml-element-link-is-already-used

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!