-1
如何用XDocument解析这个图像?Windows Phone 7解析这个xml项目
<enclosure length="1234" type="image/jpeg" url="http://asd.com/media/picture/1/80/71/3223wee.jpg" />
我的RSS看起来像这样
<item>
<title>aaa</title>
<desc>aaa</desc>
<enclosure length="3234" type="image/jpeg" url="http://asd.com/media/picture/1/80/71/1223wee.jpg" />
</item>
<item>
<title>aaa</title>
<desc>aaa</desc>
<enclosure length="1234" type="image/jpeg" url="http://asd.com/media/picture/1/80/71/3223wee.jpg" />
</item>
编辑:
工作,正确的代码:
XDocument xdoc = XDocument.Parse(e.Result);
var data = from query in xdoc.Descendants("item")
select new Cikk
{
Title = (query.Element("title") == null) ? "" : (string)query.Element("title").Value.ToString().Replace("<![CDATA[", "").Replace("]]>", ""),
Description = (query.Element("description").Value.Equals("")) ? "" : (string)query.Element("description").Value.ToString().Replace("<![CDATA[", "").Replace("]]>", "").Substring(0, 20) + "...",
Source = (query.Element("enclosure") == null) ? "" : (string)query.Element("enclosure").Attribute("url").Value
};