original_string: protected static function xmlize_result($returns, $desc) {
          if ($desc === null) {
              return '';
  
          } else if ($desc instanceof external_value) {
              if (is_bool($returns)) {
                  // we want 1/0 instead of true/false here
                  $returns = (int)$returns;
              }
              if (is_null($returns)) {
                  return '<VALUE null="null"/>'."\n";
              } else {
                  return '<VALUE>'.htmlspecialchars($returns, ENT_COMPAT, 'UTF-8').'</VALUE>'."\n";
              }
  
          } else if ($desc instanceof external_multiple_structure) {
              $mult = '<MULTIPLE>'."\n";
              if (!empty($returns)) {
                  foreach ($returns as $val) {
                      $mult .= self::xmlize_result($val, $desc->content);
                  }
              }
              $mult .= '</MULTIPLE>'."\n";
              return $mult;
  
          } else if ($desc instanceof external_single_structure) {
              $single = '<SINGLE>'."\n";
              foreach ($desc->keys as $key=>$subdesc) {
                  $value = isset($returns[$key]) ? $returns[$key] : null;
                  $single .= '<KEY name="'.$key.'">'.self::xmlize_result($value, $subdesc).'</KEY>'."\n";
              }
              $single .= '</SINGLE>'."\n";
              return $single;
          }
      }
code: protected static function xmlize_result($returns, $desc) {
          if ($desc === null) {
              return '';
  
          } else if ($desc instanceof external_value) {
              if (is_bool($returns)) {
                  // we want 1/0 instead of true/false here
                  $returns = (int)$returns;
              }
              if (is_null($returns)) {
                  return '<VALUE null="null"/>'."\n";
              } else {
                  return '<VALUE>'.htmlspecialchars($returns, ENT_COMPAT, 'UTF-8').'</VALUE>'."\n";
              }
  
          } else if ($desc instanceof external_multiple_structure) {
              $mult = '<MULTIPLE>'."\n";
              if (!empty($returns)) {
                  foreach ($returns as $val) {
                      $mult .= self::xmlize_result($val, $desc->content);
                  }
              }
              $mult .= '</MULTIPLE>'."\n";
              return $mult;
  
          } else if ($desc instanceof external_single_structure) {
              $single = '<SINGLE>'."\n";
              foreach ($desc->keys as $key=>$subdesc) {
                  $value = isset($returns[$key]) ? $returns[$key] : null;
                  $single .= '<KEY name="'.$key.'">'.self::xmlize_result($value, $subdesc).'</KEY>'."\n";
              }
              $single .= '</SINGLE>'."\n";
              return $single;
          }
      }
code_tokens: protected static function xmlize_result ( $ returns , $ desc ) { if ( $ desc === null ) { return '' ; } else if ( $ desc instanceof external_value ) { if ( is_bool ( $ returns ) ) { // we want 1/0 instead of true/false here $ returns = ( int ) $ returns ; } if ( is_null ( $ returns ) ) { return '<VALUE null="null"/>' . "\n" ; } else { return '<VALUE>' . htmlspecialchars ( $ returns , ENT_COMPAT , 'UTF-8' ) . '</VALUE>' . "\n" ; } } else if ( $ desc instanceof external_multiple_structure ) { $ mult = '<MULTIPLE>' . "\n" ; if ( ! empty ( $ returns ) ) { foreach ( $ returns as $ val ) { $ mult .= self :: xmlize_result ( $ val , $ desc -> content ) ; } } $ mult .= '</MULTIPLE>' . "\n" ; return $ mult ; } else if ( $ desc instanceof external_single_structure ) { $ single = '<SINGLE>' . "\n" ; foreach ( $ desc -> keys as $ key => $ subdesc ) { $ value = isset ( $ returns [ $ key ] ) ? $ returns [ $ key ] : null ; $ single .= '<KEY name="' . $ key . '">' . self :: xmlize_result ( $ value , $ subdesc ) . '</KEY>' . "\n" ; } $ single .= '</SINGLE>' . "\n" ; return $ single ; } }
docstring: Internal implementation - recursive function producing XML markup.
  
  @param mixed $returns the returned values
  @param external_description $desc
  @return string
docstring_tokens: Internal implementation - recursive function producing XML markup .