0
我想從一個RSS feed鏈接,像這樣:試圖從一個RSS feed鏈接與Syndicationitem
<item>
<title>
Mothers CAN wear the same clothes as their daughters
</title>
<link>
http://www.dailymail.co.uk/femail/article-4408430/Mothers-wear-clothes-daughters.html?ITO=1490&ns_mchannel=rss&ns_campaign=1490
</link>
<description>
Stylist Trinny, 53, appeared on This Morning in a pair of white striped culottes from Urban Outfitters that she bought after admiring them on her 13-year-old daughter, Lyla Elichaoff.
</description>
<enclosure url="http://i.dailymail.co.uk/i/pix/2017/04/13/13/3F36FB3200000578-0-image-a-58_1492086235218.jpg" type="image/jpeg" length="9078"/>
<pubDate>Thu, 13 Apr 2017 13:38:02 +0100</pubDate>
<guid>
http://www.dailymail.co.uk/femail/article-4408430/Mothers-wear-clothes-daughters.html?ITO=1490&ns_mchannel=rss&ns_campaign=1490
</guid>
<media:description/>
<media:thumbnail url="http://i.dailymail.co.uk/i/pix/2017/04/13/13/3F36FB3200000578-0-image-a-58_1492086235218.jpg" width="154" height="115"/>
<media:credit scheme="urn:ebu">Ken McKay/ITV/REX/Shutterstock</media:credit>
<media:content type="image/jpeg" url="http://i.dailymail.co.uk/i/pix/2017/04/13/13/3F36FB3200000578-0-image-a-58_1492086235218.jpg"/>
</item>
通過RSS訂閱源項目我的代碼迴路
private void button2_Click(object sender, EventArgs e)
{
string url = textBox1.Text;
XmlReader reader = XmlReader.Create(url);
SyndicationFeed feed = SyndicationFeed.Load(reader);
reader.Close();
foreach (SyndicationItem item in feed.Items)
{
String subject = item.Links.
articletext.Text = subject;
}
}
我已嘗試'item.links.tostring();'和'item.link'並且都沒有工作,我怎麼能得到RSS飼料的鏈接?
你在'reader'和'feed'變量中獲得什麼?注意xml中的節點是'items'而不是'items',對於'links'是相同的 –
如果我使用Item.Link.ToString();我得到以下幾點:System.ServiceModel.Syndication.NullNotAllowedCollection'1 [System.ServiceModel.Syndication.SyndicationLink] – 4334738290
如果調試正常,你可以很容易地檢查你得到什麼響應。和你需要寫什麼來獲取值。逐步檢查檢查他們添加的值。 –