XML code snippets to browser friendly HTML

断了今生、忘了曾经 提交于 2019-12-08 13:26:34
Spudley

To display strings containing reserved characters in HTML (<, > and &), you need to convert those characters into HTML entities.

For example, the HTML entity for < is &lt;.

There are tools in most languages for converting reserved HTML characters into entities. For example, in PHP, you can use the htmlentities() function.

You'll need to tell us which language(s) you're working with before I can give you any more language-specific advice though.

But in general, it's just a case of replacing all instances of those three characters with their entity alternatives, so a fairly simple set of string replacements is all you really need.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!