HTML实体连接code纯文本,而不是HTML标签 [英] html entity encode text only, not html tag

查看:141
本文介绍了HTML实体连接code纯文本,而不是HTML标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含了一堆的HTML的字符串。我想HTML的EN code中的HTML标签而不是标签本身中的文本。有没有一种简单的方法在asp.net C#3.5做到这一点。

i have a string that contains a bunch of html. i want to html-encode the text within the html tags but not the tags themselves. is there an easy way to do this in asp.net c# 3.5

推荐答案

您可以使用HTML敏捷包 HTTP ://htmlagilitypack.$c$cplex.com/ 阅读HTML然后如果需要的话通过查询他们使用HtmlEn code方法EN code的具体数值

You could use the HTMl agility pack http://htmlagilitypack.codeplex.com/ to read the HTML then if needs be use the HtmlEncode method to encode the specific values by querying them.

这篇关于HTML实体连接code纯文本,而不是HTML标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆