Create xml file from mysql
<p>Found this script what nearly does what I want; But not all the way.</p>

<pre><code>$dom = new DOMDocument;
$dom-&gt;preserveWhiteSpace = FALSE;

$table = $dom-&gt;appendChild($dom-&gt;createElement('incidents'));

foreach($result as $row) {
$data = $dom-&gt;createElement('incident');
$table-&gt;appendChild($data);

foreach($row as $name =&gt; $value) {

    $col = $dom-&gt;createElement('column', $value);
    $data-&gt;appendChild($col);
    $colattribute = $dom-&gt;createAttribute('name');

    $colattribute-&gt;value = $name;
    $col-&gt;appendChild($colattribute);
</code></pre>

<p>It now gives an xml result with:</p>

<pre><code>&lt;column name="id"&gt; and &lt;/column&gt;
</code></pre>

<p>I would like this to be </p>

<pre><code>&lt;id&gt; and &lt;/id&gt; 
</code></pre>

<p>What do I have to changed? I've tried all the options I can think of.</p>

<p>This is only the middle part. The rest seems to work fine.</p>

<p>Thanks in advance! </p>