I am creating a XML file from a database using PHP..
I am following a syntax something like this
$query = "SELECT * FROM t1 ORDER BY field1";
$resultID = mysql_query($query, $linkID) or die("Data not found.");
$row = mysql_fetch_assoc($resultID);
$xml_output .="\t\t\t\t\t\t<given_name>" . $row['fieldname'] . "</given_name>\n";
echo $xml_output
everything works well and almost a well formed XML is formed.. But there is a problem with some of the characters like &, ? etc., How can i overcome this?? I dont want to string replace these..
I want my XML to be off a special structure which needs to be validated against a specified schema..
Help appreciated..
DOMDocumentto create the XML instead of doing it by hand.