Hello,
Thank you for this performant module, so easy to use.
I tested and found some problems :

For XML output :

Attached file is exportCourt.txt (I changed from .xml to .txt because .xml is not accepted in this forum upload configuration).
When having multiple values cck fields, it's not working well if I have more than 1 value.
First node <Autres-communes> is KO.
Second node <Autres-communes> is OK because just 1 value

Besides I have a problem with accentuation in labels. See <Itin-raire> instead of Itinéraire. (Variables accentuation is OK.)

And last, I have problems with html tags. See <Itin-raire>&lt;p&gt;A Eisten....

For XLS output :
I just have the problem of multiple values. See ExportCourt.xls.
I don't know how we can represent a multiple value in a xls file. In some case, I think we can all all values in same cell, separated by a comma. In other cases, I believe as many columns as values are needed.
What do you think?

Links to nodes are here
Xml file is not representing exactly nodes because I worked on an old local backup and I changed xml to have problems condensed in just 2 nodes.

CommentFileSizeAuthor
exportCourt.xls7.82 KBsahuni
exportCourt.txt1.81 KBsahuni

Comments

sahuni’s picture

Is there a solution for that problem?

sahuni’s picture

No solution, indeed?

honza pobořil’s picture

Yes, there are solution. If the field is multiple, rendered XML tags should be rendered more times, one same tag for one value.

<node>
  <title>Title of the node</title>
  <field_link>first value</field_link>
  <field_link>second value</field_link>
</node>

BTW, this way is compatible with import by Feeds XPath parser.

sahuni’s picture

Yes I agree it should. But actually it does not.
Did you succeed to do that? without modiying the code? or patching? or is it just a wish?

honza pobořil’s picture

In my opinion, this feature requires code changes. Where is the problem?

steven jones’s picture

Category: bug » feature
Status: Active » Postponed (maintainer needs more info)

This is feature request then. Feel free to provide the patch.

Anonymous’s picture

I've solved this need by using templates : views-data-export-xml-body.tpl.php and template.php.

views-data-export-xml-body.tpl.php

This is a quick fix to skip array tag by not printing it when encountered :

<?php foreach ($themed_rows as $count => $row): ?>
  <<?php print $item_node; ?>>
<?php foreach ($row as $field => $content): ?>
<?php if (isset($content) && $content!=""): ?>
<?php
      // Suppress Array tag Array for multiple fields
      // CAUTION : the name of the tag to hide depend from Tranform Type setting in Views. In this case : camelCase
      // This is a quick fix after all !
      if ($xml_tag[$field] == "Array"): ?>
   <?php print $content; ?> 
<?php else: ?>
    <<?php print $xml_tag[$field]; ?>><?php print $content; ?></<?php print $xml_tag[$field]; ?>>  
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
  </<?php print $item_node; ?>>
<?php endforeach; ?>

template.php

Override the function theme_content_view_multiple_field() in your theme's template.php (from http://drupal.org/node/556232#comment-1957166). Don't forget to empty cache !

function mytheme_content_view_multiple_field($items, $field, $values) {
  if ($field['field_name'] != 'field_my_tuned_multivalue_field') {
    // If this is not my tuned field, then use original theme function directly.
    return theme_content_view_multiple_field($items, $field, $values);
  }

  // Separate item values with my favorite separator.
  $separator = ', ';
  $array = array();
  foreach ($items as $item) {
    if (!empty($item) || $item == '0') {
      $array[] = $item;
    }
  }
  return '<div class="field-item">'. implode($separator, $array) .'</div>';
}

At least, I did not give enough time to find why the array tag appear.

jrz’s picture

Sub...

johnv’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (duplicate)
Related issues: +#1102298: D7 multiple value field support

See attached issue.