gpt4 book ai didi

java - 解析带有地理标记数据的 RSS feed

转载 作者:行者123 更新时间:2023-12-02 08:19:43 27 4
gpt4 key购买 nike

我仍在学习如何解析不同的 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>

最佳答案

要解析 RSS 提要,您可以查看 ROME:

http://java.net/projects/rome

您还将在此问题中找到有用的信息:

https://stackoverflow.com/questions/1253788/simple-rss-parser-for-android

关于java - 解析带有地理标记数据的 RSS feed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5714267/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com