public static function toXml($writer, $data, $node) { foreach ($data as $key => $value) { if (is_numeric($key)) { $key = $node; } if (is_array($value)) { xmlwriter_start_element($writer, $key); OC_OCS::toxml($writer, $value, $node); xmlwriter_end_element($writer); } else { xmlwriter_write_element($writer, $key, $value); } } }