2014-05-22 93 views
1

任何機構請告訴我如何從描述標記中獲取圖像。從rss/Xml feeds的描述標記解析圖像windows phone

說明標籤低於

<p style="text-align: center;"><img hspace="1" height="312" border="1" align="middle"        width="300" vspace="3" src="/recipeuserfiles/Katte Pongali-andhra recipes-healthy recipes.PNG" alt="" /></p> <ul> <li>Mix the rice and Green gram dal Cook in pressure cooker and keep it side. </li> <li>Now take a vessel and heat the ghee and add add pepper, cumin seeds, curry leaves and cashew nuts to it. </li> <li>Then add the cokked rice and dal , salt and mix it properly. </li> <li>Delicious pongali is ready to taste. Have it with any of your favorite chutney.</li> </ul> 

任何幫助,將不勝感激。

在此先感謝

回答

0

您可以使用HtmlAgilityPack從HTML提取信息容易。例如:

var html = @"<p style=""text-align: center;""><img hspace=""1"" height=""312"" border=""1"" align=""middle""        width=""300"" vspace=""3"" src=""/recipeuserfiles/Katte Pongali-andhra recipes-healthy recipes.PNG"" alt="""" /></p> <ul> <li>Mix the rice and Green gram dal Cook in pressure cooker and keep it side. </li> <li>Now take a vessel and heat the ghee and add add pepper, cumin seeds, curry leaves and cashew nuts to it. </li> <li>Then add the cokked rice and dal , salt and mix it properly. </li> <li>Delicious pongali is ready to taste. Have it with any of your favorite chutney.</li> </ul>"; 
var doc = new HtmlDocument(); 
doc.LoadHtml(html); 
var src = doc.DocumentNode.SelectSingleNode("//img").GetAttributeValue("src", ""); 

//this will print /recipeuserfiles/Katte Pongali-andhra recipes-healthy recipes.PNG 
Console.WriteLine(src); 

有涉及如何安裝HAP並開始使用它在網上很多文章/教程,你可以隨時搜索。

+0

我寫了相同的code.I沒有得到任何錯誤,即使圖像沒有顯示。我無法理解的問題是,請幫助我。我在這個從很多天掙扎。 – deepu