How to echo an XML string to an HTML page for debugging? How to echo an XML string to an HTML page for debugging? xml xml

How to echo an XML string to an HTML page for debugging?


You can use htmlentities to output the XML string so that you can get a plaintext view of it in a browser.

<?php echo htmlentities( $xml_string); ?>

Alternatively, you can parse the XML string to reveal the error message, but this may be more complicated than what you need.


Try echo htmlentities($var, ENT_COMPAT, 'UTF-8')


i always use this:

echo "<pre>". htmlentities($s) . "</pre>";