开发者

XML code snippets to browser friendly HTML

Is there an开发者_开发问答 online tool to convert XML code snippets to browser friendly html?

I just want to post my XML code to a forum for viewing purposes and nothing else but the TAGs mess up the HTML.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜