【问题标题】:How do I parse an RSS feed?如何解析 RSS 提要?
【发布时间】:2010-12-31 22:54:38
【问题描述】:

我有一个关于 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 文件。我希望能够解析此站点的内容,如何以可操作的方式获取它?像结构化括号之类的?

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

谢谢!!

【问题讨论】:

    标签: xml parsing rss


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-10-28
      • 2012-06-12
      • 2018-01-31
      • 2014-08-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多