@Abdur...
Thanks for that comment... i used the same approach and i seem to be getting the correct data for the xml where i have to switch between the keys supplied....
i have data like
<themes> <theme> .... </theme> <theme> </theme> </themes>
<packages> <packagedata> .... </packagedata> <packagedata> </packagedata> </packages>
This is what i used....
if(!is_numeric($key)){
echo "<pre>";
switch( $key ){
case "themes":
$themesNode = $xml_template_info->addChild( "themes");
$themesValues = array_values( $value ) ;
for ( $i = 0; $i< count( $themesValues[0] ) ; $i++ ){
$curKeys = array_keys($themesValues[0][$i] );
$curValues = array_values($themesValues[0][$i] );
$curNode = $themesNode->addChild( "theme");
for( $j=0; $j< count( $curKeys ) ; $j++){
$curNode->addChild( $curKeys[$j], $curValues[$j] );
}
}
break;
case "pages":
break;
default:
$subnode = $xml_template_info->addChild("$key");
array_to_xml($value, $subnode);
break;
}
}