XML代码片段浏览器友好的HTML [英] XML code snippets to browser friendly HTML

查看:129
本文介绍了XML代码片段浏览器友好的HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有在线工具将XML代码片段转换为浏览器友好的html?



我只想将我的XML代码发布到论坛以供查看,但标签混淆了HTML。

解决方案

要在HTML中显示包含保留字符的字符串(< > & ),您需要将这些字符转换为HTML实体。



例如,< 的HTML实体是& lt;



大多数语言都有用于将保留的HTML字符转换为实体的工具。例如,在PHP中,您可以使用 htmlentities() 函数。



尽管我可以给你更多语言特定的建议,但你需要告诉我们你正在使用哪种语言。 b
$ b

p>

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.

这篇关于XML代码片段浏览器友好的HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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