如何解析 RSS 提要?

发布于 2024-10-10 01:53:41 字数 1285 浏览 0 评论 0原文

我有一个关于 RSS 源和 XML 的简单问题。我有相当多的 XML 经验,但没有解析 RSS 提要的经验。据我了解,RSS通常使用XML来传输数据。如果我可以从我想要解析的网站获得结构良好的 XML,我就可以开始了。

问题是,当我单击网站上的 RSS 链接时,即使 URL 以 XML 文件结尾:

...l.com/resources/classifieds/rss_144.xml

当我单击它时,网站包含的内容根本不是结构化的 XML(这是在浏览器窗口):

Classifieds : Recreational Vehicles / Motorcycles, Road Bikes Used en-us http://www....l.com/index.php?nid=231&cat=144 ...L Classifieds : Recreational Vehicles / Motorcycles, Road Bikes Used $14,900.00 : 2007 Harley Davidson Fat Boy http://www....l.com/index.php?nid=218&ad=13841365&cat=144 Start the new year off right with a new Fat Boy! I am selling my 2007 Harley Davidson Fat Boy to make room for our new baby. not only do you get a b Fri, 31 Dec 2010 15:05:42 -0700 http://www....l.com/index.php?nid=218&ad=13841365&cat=144 $1,750.00 : 1985 Honda Goldwing GL1200 Aspencade Edition - Air Rid... http://www....l.com/index.php?nid=218&ad=13841353&cat=144 1985 Honda Goldwing GL 1200 Aspencade Edition - Air Ride - Motorcycle with LOW MILES.Check out this 1985 Honda Goldwing GL1200. ONLY 53,426 miles!!! Fri, 31 Dec 2010 14:45:04 -0700 

但正如我所提到的,该 url 表明该文件是一个 XML 文件。我希望能够解析该网站的内容,如何以可操作的方式获取它?就像结构化括号之类的?

我需要使用某种解析器吗?

谢谢!!

I have a simple question regarding RSS feeds and XML. I have quite a bit of experience with XML, but no experience parsing RSS feeds. From what I understand, RSS typically uses XML to transfer data. If I could get well structured XML from the website that I want to parse, I would be good to go.

The problem is that when I click on the RSS link on the site, even though the URL ends with an XML file:

...l.com/resources/classifieds/rss_144.xml

When I click on it, the website contains content that isn't structured XML at all (this is what is viewable in the browser window):

Classifieds : Recreational Vehicles / Motorcycles, Road Bikes Used en-us http://www....l.com/index.php?nid=231&cat=144 ...L Classifieds : Recreational Vehicles / Motorcycles, Road Bikes Used $14,900.00 : 2007 Harley Davidson Fat Boy http://www....l.com/index.php?nid=218&ad=13841365&cat=144 Start the new year off right with a new Fat Boy! I am selling my 2007 Harley Davidson Fat Boy to make room for our new baby. not only do you get a b Fri, 31 Dec 2010 15:05:42 -0700 http://www....l.com/index.php?nid=218&ad=13841365&cat=144 $1,750.00 : 1985 Honda Goldwing GL1200 Aspencade Edition - Air Rid... http://www....l.com/index.php?nid=218&ad=13841353&cat=144 1985 Honda Goldwing GL 1200 Aspencade Edition - Air Ride - Motorcycle with LOW MILES.Check out this 1985 Honda Goldwing GL1200. ONLY 53,426 miles!!! Fri, 31 Dec 2010 14:45:04 -0700 

But as I mentioned, the url suggests this file is an XML file. I want to be able to parse through this sites content, how do I get it in a way that in manipulatable? Like with structured brackets and such?

Is there some sort of parser I need to use or something?

Thanks!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

紙鸢 2024-10-17 01:53:41

在某些浏览器中,当您尝试查看 RSS 源时,它仅显示文本。在浏览器中选择“查看源代码”以查看实际的 XML。

In some browsers, when you try to view an RSS feed, it only shows the text. Select View Source in your browser to see the actual XML.

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