Tips – How to display a XML Tags in a HTML Web Page

Displaying a XML document in HTML would not display properly because the browser will apply formatting to XML document and one of the way to tell browser not to apply formatting is to use the ‘<’

For example if you would like to show the following XML code in your html page.

    <body>Don’t forget me this weekend!</body>

it will display as shown below

Don't forget me this weekend!

and if you want avoid this behaviour then all you need to do is to replace all < element with ‘&lt;’ (remove single quotes).

In Category: Blogging, General

Ravi Shankar

A Software developer and blogger who is always looking to provide technical help to the wider community.

Show 1 Comment
  • dzarder January 27, 2012, 8:35 pm

    This technique was exactly what I was looking for. So simple too. Thanks.

Leave a Comment

Get your free copies of the following tech guides by joining the Digital Answers mailing list.