Display XML content in HTML page Display XML content in HTML page xml xml

Display XML content in HTML page


Simple solution is to embed inside of a <textarea> element, which will preserve both the formatting and the angle brackets. I have also removed the border with style="border:none;" which makes the textarea invisible.

Here is a sample: http://jsfiddle.net/y9fqf/1/


You can use the old <xmp> tag. I don't know about browser support, but it should still work.

<HTML>your code/tables<xmp>    <catalog>        <cd>            <title>Empire Burlesque</title>            <artist>Bob Dylan</artist>            <country>USA</country>            <country>Columbia</country>            <price>10.90</price>            <year>1985</year>        </cd>    </catalog></xmp>

Output:

your code/tables<catalog>    <cd>        <title>Empire Burlesque</title>        <artist>Bob Dylan</artist>        <country>USA</country>        <country>Columbia</country>        <price>10.90</price>        <year>1985</year>    </cd></catalog>