0

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?

rene
  • 41,474
  • 78
  • 114
  • 152
grizzo
  • 141
  • 1
  • 3
  • 10
  • All the code you show has nothing to do with your question, does it? Please revisit [ask]. – rene Jun 17 '14 at 09:56
  • Why? I showed how the datas are organized and inserted in the class to be as clear as possible, what's wrong? – grizzo Jun 17 '14 at 10:15
  • I understand your question as: In `Text` I now get content like `

    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
  • Exactly, the problem is that the strings are included in the above class, and I don't know how to retrieve them. – grizzo Jun 21 '14 at 07:11
  • This should get you going: http://stackoverflow.com/questions/56107/what-is-the-best-way-to-parse-html-in-c – rene Jun 21 '14 at 10:17

0 Answers0