March 1st, 2013, 01:34 AM
Displaying xml code in the html or php page
I need to display xml code in html page's div.
I tried here but it is not working. If you scroll down you see some strange cde in the divs.
I tries <pre> or <code> but no luck.
What do you recommend?
March 1st, 2013, 02:00 AM
The browser will try to treat the XML as if it were HTML.
Use a PRE and htmlentities() the XML.
March 1st, 2013, 04:36 AM
Can't! It closes the php
Originally Posted by requinix
<?php echo '
<?xml *version="1.0"?><?xml *version="1.0"?>
March 1st, 2013, 01:35 PM
It won't if you put it in a string. Or a heredoc:
<pre><?php echo htmlentities(<<<XML