I am learning the art of using PHP to dynamically generate XML to send back to an AJAX request and I am running into an error parsing the XML due to a mysterious BR tag at the end of the XML.
Following is the stripped down (security and initialization removed) PHP code that creates the XML:
<?php
session_start();
session_id($session_id);
header(“Content-type: text/xml”);
echo ‘<?xml version=”1.0″ encoding=”UTF-8″?>’;
echo ‘<data>’;
echo ‘<comment>’.htmlentities($comment).”</comment>”;
echo ‘<commentorName>’.htmlentities($user->display_name).'</commentorName>’;
echo ‘<commentorURL>’.$user->profile_url().'</commentorURL>’;
echo ‘<commentorImage>’.$image_path.'</commentorImage>’;
echo ‘<approved>’.$approved.'</approved>’;
echo ‘<commentID>’.$new_id.'</commentID>’;
echo ‘</data>’;
?>
Is there some trick that I need to do to not include a <br /> after the closing </data> tag?
Thanks in advance for any advice!