I have a xml like that:
<item>
<name>chuck - norris</name>
</item>
I can get full name from there and add it to listbox with this:
.......
.......
public class helperclass
{
string helper;
public string Helper
{
get {return helper; }
set {helper = value; }
}
}
.......
.......
//xml comes from internet
void something_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
XElement xml = XElement.Parse(e.Result);
var info = from somexml in xml.Descendants("item")
select new helperclass
{
Helper = (string)somexml.Element("name")
};
listBox1.ItemsSource = info;
.......
But how can I replace that ” – ” with line break so I can get:
chuck
norris
instead of:
chuck – norris
and how to get only first name?
Use Linq to XML instead: