开发者

java: find RSS file(s) of a website

开发者 https://www.devze.com 2023-04-08 23:45 出处:网络
I am writing a java application; using Rome lib for reading RSS feeds of a RSS file of a website. I can read and manage feeds using Rome but I can not find the exact URL path of RSS file. I know there

I am writing a java application; using Rome lib for reading RSS feeds of a RSS file of a website. I can read and manage feeds using Rome but I can not find the exact URL path of RSS file. I know there is a line like this in html file specifying the RSS xml file url:

<link rel="alternate" type="application/rss+xml" href="/开发者_Python百科rss.ashx" title="Rss feed for yourdomain.com" />

what is a clean way to find RSS file, url path in java?

thank you all


You could use a xpath expression on the html page to get the <link />-Node and extract the href attribute. Out of the box this will only work on wellformed XHTML pages. Maybe you need to fix the document before applying the xpath.

Or you use something like http://jsoup.org/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号