Well then.. help yourself 🙂
if anyone wonders how to convert array to xml.. try this:
$a = array("first", "second", "third" => "doof", "fourth", "fifth" => array("fifth.first", "fifth.second" => "value"), "sixth");
$index = 0;
$xml = new_xmldoc("1.0");
$root = $xml->add_root("myRoot");
function arrayfraese ($a, $node) {
global $index, $nodecache;
foreach ($a as $key => $value) {
if (is_int($key)) {
// numerical array
if (is_array($value)) {
// something went wrong!
echo "unsupported construct";
exit;
} else {
$node->new_child($value, null);
}
} else {
// associative array
if (is_array($value)) {
$nodecache[$index] = $node;
$index++;
$key = preg_replace('/_*$/', "", $key);
$mynode =& $node->new_child($key, null);
arrayfraese($value, $mynode);
$index--;
$node = $nodecache[$index];
} else {
$node->new_child($key, $value);
}
}
}
}
arrayFraese($a, $root);
echo "<br/>";
print htmlentities($xml->dumpmem());
?>