从Rss Feed windowsphone的描述标签中解析图像 [英] Parsing image from Description Tag of Rss Feed windowsphone
本文介绍了从Rss Feed windowsphone的描述标签中解析图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以帮助我如何从Rss Feed的描述标签中获取图片。
Can anybody plz help how can i get image from the description tag of Rss feed.
下面给出的是描述标签
< description>
推荐答案
您好,
您可以这样做。
string s =
"<description><p style=\"text-align: center;\"><span style=\"color: rgb(128, 0, 0);\"><strong><span style=\"font-size: medium;\">Peas Masala Rice Recipe <br /> </span></strong></span></p> <p style=\"text-align: center;\"><span style=\"color: rgb(128, 0, 0);\"><strong><span style=\"font-size: medium;\"><img width=\"300\" vspace=\"3\" hspace=\"1\" height=\"250\" border=\"1\" align=\"middle\" src=\"/recipeuserfiles/Peas Masala Rice Recipe.jpg\" alt=\"\" /></span></strong></span></p> <p><strong>Ingredients <br /> </strong></p> <p>* 1 cup Rice</p> <p>* 1/2 Coconut</p> <p>* 2 Green Chillies</p> <p>* 1 small Ginger</p> <p>* 1/2 cup Green Peas</p> <p>* 2 tsp Oil</p> <p>* 2 Cardamoms</p> <p>* 4 Cloves</p> <p>* 1 Cinnamon</p> <p>* Salt to taste</p> <p>* Coriander leaves</p> <p>* Mustard seeds</p> <p>nbsp;</p> <p><strong>Preparation <br /> </strong></p> <p>* First grind coconut (grated), ginger, cinnamon, cloves, green chillies, cardamom to a smooth paste by adding little water.</p> <p>* In a pressure pan, add oil and add mustard seeds to the ground masala and saute well.</p> <p>* Clean the rice in running water and add to the masala.</p> <p>* Stir well for two minutes.</p> <p>* Add the green peas, 2 1/4 cup water and salt.</p> <p>* Close the pressure pan. Keep for 2 or 3 sounds.</p> <p>* Remove from fire.</p> <p>* When the pressure becomes normal, transfer the bath in a bowl and stir it.</p> <p>* Garnish with coriander leaves.</p></description>";
XDocument doc = XDocument.Parse(s);
if (doc.Descendants("img").Any())
{
var imgTag = doc.Descendants("img").First();
var width = imgTag.Attribute("width").Value;
}
如果你想访问一个元素的值,那么你可以这样做
If you want to access the value of an element, then you could do something like this
var value_of_an_elemnt= imgTag.Value;
这篇关于从Rss Feed windowsphone的描述标签中解析图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文