//foreach($xml as $tool){
     //if(isset($tool->type)){
     if (isset($xml['name'])) {
         $tool_type = dom_import_simplexml($xml)->tagName;
         $type = '';
         switch ($tool_type) {
             case 'cl:ControlList':
                 $type = 'list';
                 break;
             case 'es:EvaluationSet':
                 $type = 'scale';
                 break;
             case 'ru:Rubric':
                 $type = 'rubric';
                 break;
             case 'ce:ControlListEvaluationSet':
                 $type = 'listscale';
                 break;
             case 'sd:SemanticDifferential':
                 $type = 'differential';
                 break;
             case 'mt:MixTool':
                 $type = 'mixed';
                 break;
             case 'ar:ArgumentSet':
                 $type = 'argumentset';
                 break;
         }
         $title = htmlspecialchars($xml['name'], ENT_QUOTES);
         $result = new evalcomix_tool('', $environment->id, $title, $type, $tool);
     } else {
         return false;
     }
     //}
     return $result;
 } else {