错误的html标签
问题描述:
有没有简单的方法来纠正错误解释的html标签? 例如:我有一个HTML文件以下文字:错误的html标签
<div class=paragraph style=" padding:0.00pt 18.48pt 0.00pt 19.68pt; text-align:left;"><span class=font29 style=" line-height:10.56pt;">Here is some text. and here comes a <wrongly interpreted html-tag> how can the "<" and ">" be removed?</span></div>
我如何可以提取并纠正一切错误地解释html标签? 我想到了一个列表,我添加了所有“正确的”html标签。但我不知道这是否会工作...
感谢您的任何帮助! :)
答
您应该使用HTML entities。例如<
应该用HTML编写为<
(小于)和>
作为>
(大于)。然后
你的字符串看起来像:
<div><span>Here is some text. and here comes a <wrongly interpreted html-tag> how can the "<" and ">" be removed?</span></div>
不要做无效的标记在首位。在文字中使用'<'和'>'而不是''。一旦你打破了一个鸡蛋,很难将它塞回壳中。 – Amadan 2014-09-24 08:56:49
嗯,事情是,我所有的文件包含已经“”... – MarkF6 2014-09-24 09:49:58