验证RSS提要 [英] Validating an RSS feed
问题描述
我正在开发一个应用程序,该应用程序允许用户将自己的RSS提要添加到各种简单的阅读器中.
I'm working on an application that allows users to add their own RSS feeds to a simple reader of sorts.
当前,我正在使用xml_domit_rss
作为解析器,但不确定在解析之前是否确实在验证URL.
Currently, I'm using xml_domit_rss
as the parser but I'm unsure if it's actually validating the URL before parsing.
从我可以在线收集的信息来看,好像通过使用服务 https:验证与解析是分开的: //www.feedvalidator.org 或其他一些方法,例如parse_url()
.
From what I can gather online, it looks as if validating is separate from the parse, either by using a service https://www.feedvalidator.org or some other method such as parse_url()
.
任何人都对xml_domit_rss
的验证方式或将URL发送到解析器之前可以进行验证的方法有什么了解?
Anyone have some insight into either how xml_domit_rss
validates, or a method by which I can validate before sending the URL to the parser?
推荐答案
很简单,您可以使用 Atom 1.0 和
It's simple, You can do that using SyndicationFeed. It supports Atom 1.0 and RSS 2.0 versions.
try
{
SyndicationFeed fetchedItems = SyndicationFeed.Load(XmlReader.Create(feedUrl));
// Validation successful.
}
catch { // Validation failed. };
这篇关于验证RSS提要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!