本文介绍了在Silverlight WP7中删除HTML标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试从正在下载的RSS feed中删除HTML标记,并将这些条目从RSS feed中添加到listBox中.

我知道这可以用来删除HTML标记,但是请注意我将如何在代码中实现它.

Hi,

I am trying to remove HTML tags from an RSS Feed that I am downloading and adding the items from the RSS feed into a listBox.

I know that this can be used to remove HTML tags, but I am note sure how I would implement it into my code.

public string Strip(string text)
{
     return Regex.Replace(text, @"<(.|\n)*?>", string.Empty);
}


这是我的代码,我正在尝试从description元素中删除HTML标记.


Here is my code, I am trying to remove the HTML tags from the description element.

XElement xmlScan = XElement.Parse(e.Result);

listBox1.ItemsSource = from channel in xmlScan.Descendants("item")
                       select new ScanItem
                       {
                         title = channel.Element "title").Value,
                         description = "Position: " + channel.Element("description").Value
                       };

推荐答案

description = "Position: " + channel.Element("description").Value



与此:



with this:

description = "Position: " + Strip(channel.Element("description").Value)



这篇关于在Silverlight WP7中删除HTML标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-01 07:16