Xml parse error


I am new to xml.

I am trying to generate the xml file by looping through records from database. It is working fine. But if the data field is having
any special character like & it is giving error xml parse error.

I came to know that we can use CDATA to avoid it.

please let me know how to use CDATA

print($row[‘pickup_addr’]); //value for internal code

on this I want to use CDATA

please help me out




thanks for your reply

I checked the link. But it is not there what i am looking for

A CDATA section starts with “<![CDATA[” and ends with “]]>”. You can use one of the following examples.

echo "<cell><![CDATA[" . $row['pickup_addr'] . "]]></cell>";

function cdata($s)
        return "<![CDATA[" . $s . "]]>";

echo "<cell>" . cdata($row['pickup_addr']) . "</cell>";