解析带有地理标记数据的 RSS feed
我仍在学习如何解析不同的 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>
I am still learning how to parse different XML feeds, so I was wondering how will one go about parsing an XML feed like the one below. is it possible to parse this without knowing the different XMl tags? Any steps to this, links or tutorial will be helpful.
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要解析 RSS 提要,您可以查看 ROME:
http://java.net/projects/rome
您还可以在此问题中找到有用的信息:
https://stackoverflow.com/questions/ 1253788/simple-rss-parser-for-android
For parsing RSS feeds you can get a look at ROME:
http://java.net/projects/rome
You'll also find useful info in this question:
https://stackoverflow.com/questions/1253788/simple-rss-parser-for-android