我有内容:来自 rss 的如下编码文本:
<content:encoded><![CDATA[<P><B>Wednesday, September 26, 2012</B></P>It is Apple.<P>Shops are closed.<br />Parking is not allowed here. Go left and park.<br />All theatres are opened.<br /></P><P><B>Thursday, September 27, 2012</B></P><P>Shops are open.<br />Parking is not allowed here. Go left and park.<br />All theatres are opened.<br /></P>]]></content:encoded>
使用以下方法,我可以从 HTML 中提取文本:
public static string StripHTML(this string htmlText)
{
var reg = new Regex("<[^>]+>", RegexOptions.IgnoreCase);
return HttpUtility.HtmlDecode(reg.Replace(htmlText, string.Empty));
}
但是我希望将其中的文本<b></b>
插入到 dateArray[] 中,并将其中的文本<p></p>
插入到 descriptionArray[] 中,以便我可以显示如下:
提前致谢。