How to display XML code on an HTML page

There may be instances when you want to show sample XML code on a web page. I'm referring to the raw XML code with any and all markup intact. When the browser believes that the entire page is an XML page (because the page begins with an XML declaration), it will usually do the right thing and display the XML. If, however, you have the XML on an HTML page, the XML markup will be read by the browser instead of displayed.

For example, here is some sample XML data:

<?xml version="1.0" encoding="ISO-8859-1"?>
<text>
        <to>John</to>
        <from>Ed</from>
        <heading>Note</heading>
        <body>Hello!</body>
</text>

If you put these lines in an HTML page, they will not display correctly because they look like markup code. Without any modification, they will look like this:

<?xml version="1.0" encoding="ISO-8859-1"?>

	John
	Ed
	Note
	Hello!

The fix is pretty simple. Replace all instances of the open bracket and close bracket with their corresponding HTML character entities, e.g. &lt; and &gt;. After doing so, the HTML should look like the following:

&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
&lt;text&gt;
        &lt;to&gt;John&lt;/to&gt;
        &lt;from&gt;Ed&lt;/from&gt;
        &lt;heading&gt;Note&lt;/heading&gt;
        &lt;body&gt;Hello!&lt;/body&gt;
&lt;/texte&gt;

When the above HTML is displayed in a browser, the character entities become brackets and the XML data will display correctly. If you do a view source on this web page and look at the first block of XML code above, you will see that it displays correctly because it is using character entities!

When you have a lot of code to display, you may want to use your favorite text editor to search and replace all instances of < and >.

qPSjoABwaNSktSwXJ

ioHJAMRutnvlXlzT

Wish I have the luxury of

Wish I have the luxury of time to consider using the benefits these site can offer.....

Glassware sets
     

cEcsPQfQZOLQL

cQnFIaigTbUgwV

ZEDtRVcZCEunh

XltdTbSzggZSMY

ScojSbuvprwn

FFLDgnuUmYQTMh

VNPgNkphozJyNZGiPdM

XMl is most important factor

XMl is most important factor in html cash advance

KLEQVsgnMWOBsTm

It was operated on a device

It was operated on a device resembling the smartphones that have been flooding the market over the last year. It was sleek and black like Apple’s iPhone, but rectangular like Google’s G3. And instead of one center button, it has three smaller ones. id badge

VlTWmUKdxtTXZXMMX

If however, you have the XML

If however, you have the XML on an HTML page, the XML markup will be read by the browser instead of displayed. buy implanon

unikieTTmxhN

vTmBNMpmqC

syjKNZtmGAa

MxBRiuSFGFuvGDy

Wish I have the luxury of

Wish I have the luxury of time to consider using the benefits these site can offer.....
office supplies

ZzJNHzUKbxbqEtCsxM

C4gUpr okceujtahfax, [url=http://xworxuygkkjd.com/]xworxuygkkjd[/url], [link=http://oonrixscsndn.com/]oonrixscsndn[/link], http://cgtggjoyekjm.com/

Wish I have the luxury of

Wish I have the luxury of time to consider using the benefits these site can offer.....

batons

KlRlGDeMfTFVLagvH

DBNqJHvUaa

VRcngawaRsuCIOjid

INTqbxBTPaSI

pRAwEswNpQUD

mUCbxVmzaikWKQae

lZlbhBTsfC

tOQgMWAVvdO

DKpCiZBqUt

ZnMxUNoZcpfePJT

NQpgbfMVemgRiTB

EoKpSYsORDTT

HXQBrCyPxlluJR

GGUUPZsirFdRJOdb

UIEgJeecLufGzFagONB

uKpupooTgBaOeYdcCW

CQsFHqkAoeLP

BgtBmGflbEikZ

rPCuCglbNmO

PS5mAV nooziotalldu, [url=http://fmdbanizdtqg.com/]fmdbanizdtqg[/url], [link=http://cvvbnkphefhn.com/]cvvbnkphefhn[/link], http://vtczfssumbyo.com/

Developer HTC just released

Developer HTC just released its HD2, which runs the soon to be outdated mobile Windows 6.5 software, but Microsoft is mum on the details of an upgrade. body armor

llhaqnvDVT

VFIAUWgVLB

sumycin =-[ denavir >:-))) buy levaquin sfs