/**
  * Creates a transition Object
  * 
  * @param SimpleXMLElement $xml         containing the structure of the imported workflow
  * @param array            &$xmlMapping containig the newly created formElements idexed by their XML IDs
  * 
  * @return Transition The transition object, or null if error
  */
 public function getInstanceFromXML($xml, &$xmlMapping)
 {
     $from = null;
     if ((string) $xml->from_id['REF'] != 'null') {
         $from = $xmlMapping[(string) $xml->from_id['REF']];
     }
     $to = $xmlMapping[(string) $xml->to_id['REF']];
     $transition = new Transition(0, 0, $from, $to);
     $postactions = array();
     if ($xml->postactions) {
         $tpaf = new Transition_PostActionFactory();
         foreach (array('postaction_field_date', 'postaction_field_int', 'postaction_field_float') as $post_action_type) {
             foreach ($xml->postactions->{$post_action_type} as $p) {
                 $postactions[] = $tpaf->getInstanceFromXML($p, $xmlMapping, $transition);
             }
         }
     }
     $transition->setPostActions($postactions);
     //Permissions on transition
     if ($xml->permissions) {
         $permissions = array();
         foreach ($xml->permissions->permission as $perm) {
             $ugroup = (string) $perm['ugroup'];
             if (isset($GLOBALS['UGROUPS'][$ugroup])) {
                 $permissions[] = $GLOBALS['UGROUPS'][$ugroup];
             }
             $transition->setPermissions($permissions);
         }
     }
     return $transition;
 }