Fwrite xml file with attributes

Hi,

I am looking for a way to write an xml with attributes like this :

<announcements>
<news title=“Groove Magazine#98/N7 CD” date=“2006” image=“images/news/groovethumb.jpg” hoes=“images/news/groove.jpg” aside=“if.mp3” buy=“not for sale”>
<copy>
<p>
Compilation with various artists like Henrik Schwarz, I:Cube, Steve Spacek a.o
</p>
</copy>
</news>

I now have this script, but that generates an xml my flash file cannot read. The script is :

<?php

header(“Content-type: text/xml”);

$host = “localhost”;
$user = “joomla108”;
$pass = “******l”;
$database = “joomla108”;

$linkID = mysql_connect($host, $user, $pass) or die(“Could not connect to host.”);
mysql_select_db($database, $linkID) or die(“Could not find database.”);

//$query = “SELECT * FROM jos_content ORDER BY created DESC”;
$query = “SELECT * FROM jos_content WHERE sectionid=‘1’ ORDER BY sectionid DESC”;
$resultID = mysql_query($query, $linkID) or die(“Data not found.”);

$xml_output = "<?xml version=“1.0”?>
";
$xml_output .= "<announcements>
";

for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= " <news>
“;
$xml_output .= " <date>” . $row[‘created’] . "</date>
“;
$xml_output .= " <title>” . $row[‘title’] . "</title>
“;
$xml_output .= " <intro>” . $row[‘introtext’] . "</intro>
“;
$xml_output .= " <full>” . $row[‘fulltext’] . "</full>
";
$xml_output .= " </news>
";
}

$xml_output .= “</announcements>”;

echo $xml_output;

$printout = fopen(‘main.xml’,‘w’);
fwrite($printout,$xml_output);
fclose($printout);
//mail($from, $subject, $klantbericht, $additionalHeaders);

?>

The above php code generates an xml without attributes but with childes. Anybody an idea how to get php to write attributes instead of childs ?

Thx in advance !

Bart