我还在学习如何解析不同的XML提要,所以我想知道如何解析像下面那样的XML提要。是否有可能在不知道不同的XMl标签的情况下解析它?任何步骤,链接或教程都会有所帮助。
http://earthquake.usgs.gov/earthquakes/catalogs/eqs1hour-M1.xml
<?xml version="1.0"?>
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>USGS M 1+ Earthquakes</title>
<description>Real-time, worldwide earthquake list for the past hour</description>
<link>http://earthquake.usgs.gov/earthquakes/</link>
<dc:publisher>U.S. Geological Survey</dc:publisher>
<pubDate>Wed, 16 Nov 2011 11:47:10 GMT</pubDate>
<item>
<pubDate>Wed, 16 Nov 2011 11:41:25 GMT</pubDate>
<title>M 1.1, Central California</title>
<description>November 16, 2011 11:41:25 GMT</description>
<link>http://earthquake.usgs.gov/earthquakes/recenteqsus/Quakes/nc71682246.php</link>
<geo:lat>37.5637</geo:lat>
<geo:long>-118.8648</geo:long>
<dc:subject>1</dc:subject>
<dc:subject>pasthour</dc:subject>
<dc:subject>4.60 km</dc:subject>
<guid isPermaLink="false">nc71682246</guid>
</item>
<item>
<pubDate>Wed, 16 Nov 2011 11:15:18 GMT</pubDate>
<title>M 4.5, Kodiak Island region, Alaska</title>
<description>November 16, 2011 11:15:18 GMT</description>
<link>http://earthquake.usgs.gov/earthquakes/recenteqsww/Quakes/ak10358657.php</link>
<geo:lat>57.6877</geo:lat>
<geo:long>-153.8939</geo:long>
<dc:subject>4</dc:subject>
<dc:subject>pasthour</dc:subject>
<dc:subject>39.50 km</dc:subject>
<guid isPermaLink="false">ak10358657</guid>
</item>
</channel>
</rss>
答案 0 :(得分:2)
要解析RSS提要,您可以查看ROME:
您还可以在此问题中找到有用的信息:
https://stackoverflow.com/questions/1253788/simple-rss-parser-for-android