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

发布于 2024-11-02 08:57:38 字数 2142 浏览 1 评论 0原文

我仍在学习如何解析不同的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

羞稚 2024-11-09 08:57:38

要解析 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文