how can i fix this XML error
<p>i saved a string into database<br>
then i retrieved that data in xml format in a php file and call that xml data from another php
file. it works fine for simple text record stored in database but when i save a string like this 
i replace &lt; to &amp;lt and > &amp;gt then save to database</p>

<pre> if x&lty and y>z</pre>

<p>and retrieve in php file it out put is an xml structure
e.g</p>

<pre>&ltquestions>&ltquestion>&ltquestion_id>2&lt/question_id><br/>&ltquestion>what is matrix&lt/question>&ltweight>6&lt/weight><br/>&ltsubject_code>4&lt/subject_code>&lt/question><br/><br/>&ltquestion>&ltquestion_id>3&lt/question_id>&ltquestion>squareroot 3 is&lt/question>&ltweight>3&lt/weight>&ltsubject_code>4&lt/subject_code>&lt/question><br/><br/>&ltquestion>&ltquestion_id>15&lt/question_id>&ltquestion>what is a set&lt/question>&ltweight>4&lt/weight>&ltsubject_code>4&lt/subject_code>&lt/question>&ltquestion>&ltquestion_id>16&lt/question_id><br/><br/>&ltquestion>If x &lt y, y &lt z then&lt/question>&ltweight>4&lt/weight>&ltsubject_code>4&lt/subject_code>&lt/question>&lt/questions></pre>

<p>it show me &amp;lt instead of '&lt;' in last question (if x&amp;lty and y&amp;ltz)<br/>
but when i call this from another php file it gives the error</p>

<pre>Warning: simplexml_load_string(): Entity: line 1: parser error : EntityRef: expecting ';' in /var/www/test/view/addTestQuestion.php<br/> on line 54 Call Stack: 0.0007 332148 1. {main}() /var/www/test/view/addTestQuestion.php:0 0.0222 333892 2. simplexml_load_string()<br/> /var/www/test/view/addTestQuestion.php:54 Warning: simplexml_load_string(): ubject_code>16If x /var/www/test/view/addTestQuestion.php:0 0.0222 333892 2. simplexml_load_string()<br/> /var/www/test/view/addTestQuestion.php:54 Warning: simplexml_load_string(): ^ <br/>in /var/www/test/view/addTestQuestion.php on line 54 Call Stack: 0.0007 332148 1. {main}() /var/www/test/view/addTestQuestion.php:0 0.0222 333892 2. simplexml_load_string() /var/www/test/view/addTestQuestion.php:54 Warning: simplexml_load_string(): Entity: line 1: parser error : EntityRef: expecting ';' in<br/> /var/www/test/view/addTestQuestion.php on line 54 Call Stack: 0.0007 332148 1. {main}() /var/www/test/view/addTestQuestion.php:0 0.0222 333892 2. simplexml_load_string() /var/www/test/view/addTestQuestion.php:54 Warning: simplexml_load_string(): de>16If x  line 54 Call Stack: 0.0007 332148 1. {main}() /var/www/test/view/addTestQuestion.php:0 0.0222 333892 2. simplexml_load_string() /var/www/test/view/addTestQuestion.php:54 Warning: simplexml_load_string(): ^ in<br/> /var/www/test/view/addTestQuestion.php on line 54 Call Stack: 0.0007 332148 1. {main}() /var/www/test/view/addTestQuestion.php:0 0.0222 333892 2. simplexml_load_string() <br/>/var/www/test/view/addTestQuestion.php:54 Notice: Trying to get property of non-object in /var/www/test/view/addTestQuestion.php on line 56 Call Stack: 0.0007 332148 1. {main}<br/>() /var/www/test/view/addTestQuestion.php:0 Warning: Invalid argument supplied for <br/>foreach() in /var/www/test/view/addTestQuestion.php on line 56 Call Stack: 0.0007 332148 1. {main}() /var/www/test/view/addTestQuestion.php:0</pre>

<p>any help would be greatly appreciated</p>
