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 <
.
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.
精彩评论