1

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.

1 Answer 1

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.