hello i have a problem in getting picture from the url contained in the xml file:
<item>
<title>Music</title>
<photo>http://www.jawharafm.net/jfmfiles/photos/hamdi.jpg</photo>
</item>
and here’s my code c#:
XElement xmlItems = XElement.Parse(e.Result);
listBox1.ItemsSource = from channel in xmlItems.Descendants("item")
let tit = channel.Element("title")
let pho = channel.Element("photo")
select new items
{
title = tit == null ? null : tit.Value,
photo = pho == null ? null : pho.Value,
};
also i have a small problem in ignoring style balise in displaying text after parsing document like this :
<description>
<![CDATA[<style>img { max-width: 310px; }</style><div>un concours mondial, appelé "BlueHat"</span>, pour récompenser le ou la passionné d'informatique capable <span style="color: #3366ff;">10.000 dollars</span>.</div>
<div /><span style="color: #ffffff;" />....]]>
</description>
Thanks
Right where you are using the ternary operators for the photo, you need to create an instance of a
BitmapImage. Something like this:Given that
photois aBitmapImageitself.What exactly is the problem with the style tag? Since you are declaring it as a part of
CDATA, it is correctly read and interpreted as a standard string value.