简体   繁体   中英

to Identify the Html tag and replace its element in vb.net

I have data in database as below: eg

 <p><font style="BACKGROUND-COLOR: gold" size="+2" face="Arial Black"><strong>test</strong><u> test1</u> </font></p> 

I need to retrieve the data from my code and remove the html tags and apply the same element effect. if there is a tag like ,,, all these should be effected to the text provided.

so, here in above example the output will be likr test (in bold with font style) test1(with underline). test test1

Please suggest to achive this in vb.net

1) Example of HTML string parsing with C#.NET

2) http://htmlagilitypack.codeplex.com/ - This is commonly used server side parser. I would recommend this one.

3) It would be easier to manipulate the html object. Otherwise, you can try to parse with the help of string REGEX replacement and would be very tedious & complex piece to work on.

VB.NET has got asp:Literal for this.

<asp:Literal ID="literal" runat="server" />

Use it in code like this.

Dim code As String = "<p><font style=""BACKGROUND-COLOR: gold"" size=""+2"" face=""Arial Black""><strong>test</strong><u> test1</u> </font></p>"
literal.Text = code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM