我一直在尝试通过我的 RSS 链接读取 XML 文件。我正在使用 SyndicationFeed 类。问题是由于保护,我无法读取某些标签。
<item>
<title>.......................</title>
<link>................................</link>
<comments>.........................................</comments>
<pubDate>.................</pubDate>
<dc:creator><![CDATA[Abc]]></dc:creator>
<category><![CDATA[Sports]]></category>
<category><![CDATA[XYZ]]></category>
<category><![CDATA[Nba]]></category>
<guid isPermaLink="false">......................</guid>
<description><![CDATA[LOS ANGELES: NBA officiating has become too strict <a href="https://example.com/"
title="Read more" >...</a>]]></description>
<content:encoded><![CDATA[<p>...</p>
<p> .........................................</p>
<p>................................................</p>
<p>............................................................</p>
<p>..............................................</p> ]]>
</content:encoded>
<wfw:commentRss>https://example.com/feed/</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
我想读取所有 xml 节点。这是我的代码
var feedUrl = textBox1.Text;// "http://blog.stackoverflow.com/index.php?feed=podcast";
using (var feedReader = XmlReader.Create(feedUrl))
{
var feedContent = SyndicationFeed.Load(feedReader);
if (null == feedContent) return;
foreach (var item in feedContent.Items)
{
String abc_Title = item.Title.Text;
String desc = item.Summary.Text;
}
}