我目前正在使用下面的代码来尝试检查某个根节点(rss)和某个命名空间\前缀(itunes),但似乎是说即使提供了随机网页 URL,提要也是有效的而不是指向一个提要。
FeedState state = FeedState.Invalid;
XmlDocument xDoc = new XmlDocument();
xDoc.Load(_url);
XmlNode root = xDoc.FirstChild;
if (root.Name.ToLower() == "rss" && root.GetNamespaceOfPrefix("itunes") == "http://www.itunes.com/dtds/podcast-1.0.dtd")
{
state = FeedState.Valid;
}
return state;
谁能告诉我为什么会这样?