$attribute) { // rearrange things to be compatible with the Xml::fromArray() $attributes[$key] = $attributes[$key]['Attribute']; // cleanup the array from things we do not want to expose unset($attributes[$key]['Event']); unset($attributes[$key]['value1']); unset($attributes[$key]['value2']); } // display the XML to the user $xmlArray['response']['Attribute'] = $attributes; $xmlObject = Xml::fromArray($xmlArray, array('format' => 'tags')); echo $xmlObject->asXML(); ?>