/**
  * @see form_FieldService::buildXmlElementResponse()
  *
  * @param form_persistentdocument_List $field
  * @param DOMElement $fieldElm
  * @param mixed $rawValue
  * @return string
  */
 public function buildXmlElementResponse($field, $fieldElm, $rawValue)
 {
     $listObject = $field->getDataSource();
     if (!$field->getMultiple() || !is_array($rawValue)) {
         $realValue = f_util_Convert::toString($rawValue);
         if (!empty($realValue)) {
             $item = $listObject->getItemByValue($realValue);
             if ($item != null) {
                 $mailValue = $item->getLabel();
             } else {
                 $mailValue = $realValue;
             }
             if (!empty($mailValue)) {
                 $fieldElm->setAttribute('mailValue', $mailValue);
             }
         }
         return $realValue;
     } else {
         if (is_array($rawValue)) {
             $realValue = array();
             $mailValue = array();
             foreach ($rawValue as $val) {
                 $txtval = f_util_Convert::toString($val);
                 if (!empty($txtval)) {
                     $realValue[] = $txtval;
                     $item = $listObject->getItemByValue($txtval);
                     if ($item != null) {
                         $mailValue[] = $item->getLabel();
                     } else {
                         $mailValue[] = $txtval;
                     }
                 }
             }
             if (count($realValue) > 0) {
                 $fieldElm->setAttribute('mailValue', implode(" / ", $mailValue));
                 return implode(' / ', $realValue);
             }
             return '';
         }
     }
     return parent::buildXmlElementResponse($fieldElm, $fieldElm, $rawValue);
 }
 /**
  * @param form_persistentdocument_field $field
  * @param DOMElement $fieldElm
  * @param mixed $rawValue
  * @return string
  */
 public function buildXmlElementResponse($field, $fieldElm, $rawValue)
 {
     if (empty($rawValue)) {
         return '';
     }
     $retValue = '';
     if (is_array($rawValue)) {
         foreach ($rawValue as $v) {
             $retValue .= f_util_Convert::toString($v) . ' ';
         }
         $retValue = trim($retValue);
     } else {
         $retValue = f_util_Convert::toString($rawValue);
     }
     return $retValue;
 }