ab
06-25-2005, 08:03 AM
hi every one
i am trying to write data to xml file , the following code allowing doing that but the writting to the file will be copied twice , after testing the code several times i have noticed that when i remove the svg elements from the code below this allows writting to the file the data i wanted (not twice )
how can i keep svg elements in the following code with writting the data normally
thanks
<?php
header("Content-type: image/svg+xml");
print('<?xml version="1.0" encoding="iso-8859-1"?>');
print('<svg width="300" height="300" viewBox="0 0 300 300">');
print('<text x="50" y="60">fff</text>');
print('</svg>');
include ('Driving-Test.php');
$xml = simplexml_load_string($xmlstr);
$result = $xml->xpath("//answer");
$file_handle = fopen('R.xml','a');
$content = '<?xml version="1.0"?>
<results>';
foreach ($result as $row)
{
$content.="\n<result>".$row->mark."</result>\n";
}
$content .="</results>";
fwrite($file_handle,$content);
fclose($file_handle);
?>
i am trying to write data to xml file , the following code allowing doing that but the writting to the file will be copied twice , after testing the code several times i have noticed that when i remove the svg elements from the code below this allows writting to the file the data i wanted (not twice )
how can i keep svg elements in the following code with writting the data normally
thanks
<?php
header("Content-type: image/svg+xml");
print('<?xml version="1.0" encoding="iso-8859-1"?>');
print('<svg width="300" height="300" viewBox="0 0 300 300">');
print('<text x="50" y="60">fff</text>');
print('</svg>');
include ('Driving-Test.php');
$xml = simplexml_load_string($xmlstr);
$result = $xml->xpath("//answer");
$file_handle = fopen('R.xml','a');
$content = '<?xml version="1.0"?>
<results>';
foreach ($result as $row)
{
$content.="\n<result>".$row->mark."</result>\n";
}
$content .="</results>";
fwrite($file_handle,$content);
fclose($file_handle);
?>