Changing default "<response>" and "<item>" tags in XML export

Created on 15 June 2017, over 7 years ago
Updated 1 February 2023, almost 2 years ago

I am trying to make a data export from D8 content to an XML file. Views_data_export module would be ideal for this but the XML I need to make has quite strict tag name restrictions (data import to a 3rd party system). Tag names can be changed for fields but how about the higher level <response> and <item> -tags?

I did not find any documentation about this, only instructions for D7 on how to change them. It would be interesting to know if this can be accomplished on D8 version at all at the moment? If not, this ticket could be a "Feature request" instead :)

Thanks for any help in advance!

โœจ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ซ๐Ÿ‡ฎFinland sissonen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ท๐Ÿ‡ดRomania reszli Tรขrgu Mureศ™

    changes to improve functionality and code:

    • I needed some more elements inside the root node, so I introduced an additional config field called "metadata" as a textarea
    • also, I replaced the custom replacement of {{ lang }} by allowing the use of token in the attributes and metadata fields
    • additionally I switched to dep. inj. where possible

    still left to do:

    • instead of strpos and str_replace, switch to a better way of manipulating the XML (i.e. using DOMDocument)
  • ๐Ÿ‡ท๐Ÿ‡ดRomania reszli Tรขrgu Mureศ™
  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States jhedstrom Portland, OR

    The code in #47 and in the MR need to be reconciled. It would also be great to add a batch export test for these custom xml tags.

  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine chizh273

    The #47 has one issue.
    If you open the settings of the data export format with enabled warning logging ($config['system.logging']['error_level'] = 'verbose';) you will get a warning "Warning: Undefined array key "metadata" in /var/www/html/web/modules/contrib/views_data_export/src/Plugin/views/style/DataExport.php on line 241".

    I have updated the #47 patch to fix this warning.

  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland sir_squall

    Thank you very much the path #50 work well!

  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine proweb.ua

    how to add attributes to Item node name?
    can this be done via the API?

  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance jibus

    #50 works also.

    I would suggest to move the "Item wrapper node name" before "Item node name" configuration field.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States newme154

    Hello,

    I am not seeing the drop down info for the xml settings. however, I do see it for the CSV settings.

  • ๐Ÿ‡ฏ๐Ÿ‡ตJapan bassline

    #50 works

    The XML configuration worked in my environment

  • Status changed to RTBC 6 days ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada andrew.wang

    #50 works +1

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom steven jones

    This looks great, and thanks for the hard work everyone, but this sort of change really should have some tests to make sure we're not breaking things for existing sites, and that the new settings work correctly etc. so setting back to needs work.

Production build 0.71.5 2024