converting nested hash to xml
| From: | Anthony Ettinger | Date: | Fri, 28 Apr 2006 07:16:23 +0000 |
| Subject: | converting nested hash to xml | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-234978@lists.php.net to get a copy of this message | ||
Is there a standard way of converting a nested hash/multidimensional
array to an xml tree?
My hash looks like:
$foo = array(
bar1 => array(
baz1 => array(
title => "Some Title",
text => "Some Text",
),
bazN => array(...),
),
bar2 => array (...),
barN => array(...),
);
would want the output to be something like:
<foo>
<bar1>
<baz1>
<title>Some Title</title><text>Some Text</text> </baz1> <baz2>
<title>Some Title2</title><text>Some Text2</text> </baz2> </bar1> <barN>...</barN> </foo> -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html