XML代码片段浏览器友好的HTML [英] XML code snippets to browser friendly 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 <
.
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屋!