我需要将XML字符串解析为对象。我会使用SimpleXML,但是出现错误Duplicate annotation of name 'link' on field 'url' private java.lang.String com.example.rogedormans.xmlreader.XML.Alert.Channel.url。
具有相同问题的示例XML:
<rss........>
<channel>
<title>The Title</title>
<link>http://www.someurl.com</link>
<description>Some description</description>
<atom:link href="http://dunno.com/rss.xml" rel="self" type="application/rss+xml"/>
....
....
</channel>
</rss>
Run Code Online (Sandbox Code Playgroud)
我GOOGLE了一番,发现这个,这个和这个计算器的文章,但没有为我工作。我也看过了简单的XML文档,但我不能得到它的工作。
如何将两个“链接”项都放入对象?(我认为这与名称空间有关,但是呢?)
一个代码示例会很好!!!