I have a class named Article with three strings into it: - title; - link; - description.
Here's the class' code:
class Article
{
string title;
string text;
string link;
public string Title
{
get { return title; }
set { title = value; }
}
public string Text
{
get { return text; }
set { text = value; }
}
public string Link
{
get { return link; }
set { link = value; }
}
}
This class is filled thanks to a method which makes a query from an XML file:
public void toArticle(string str)
{
byte[] byteArray = Encoding.UTF8.GetBytes(str);
MemoryStream stream = new MemoryStream(byteArray);
XDocument news = XDocument.Load(stream);
var data = from query in news.Descendants("item")
select new Article
{
Title = (string)query.Element("title"),
Text = (string)query.Element("text"),
Link = (string)query.Element("link")
};
listBox.ItemsSource = data;
}
the problem is that the text tag in the XML is filled by useless HTML tags, if we ignore the actual article. so I would like to take the article's texts from the class, put them into an array, clean them from the useless tags and then reinsert them in the class. But how do put them in the array? And how do I reinsert them into the class avoiding the risk to insert only one text in the end?
some textothertexttext more text
`, how do I remove the tags from that text so that I only get `some text othertext text more text`... – rene Jun 17 '14 at 10:23