Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello community,
Thanks for the great module.
I am looking for a solution where webform submissions are added to an XML datafile like below.
Thanks for feedback!
Frederik
<?xml version="1.0" encoding="UTF-8"?>
<records version="1">
<campaign id="TESTCAMPAIGN" />
<record id="90210">
<telephone_number>0600000001</telephone_number>
<initials>T.C.</initials>
<prefix>de</prefix>
<surname>Testconsument</surname>
<postal>9999ZZ</postal>
<street>Telecomlaan</street>
<housenumber>29</housenumber>
<housenumber_suffix>C</housenumber_suffix>
<city>Testerdam</city>
<product>Testsetje no. 30</product>
<color>Green</color>
</record>
<records version="2">
<campaign id="TESTCAMPAIGN" />
<record id="90212">
<telephone_number>0600000222</telephone_number>
<initials>T.C.</initials>
<prefix>de</prefix>
<surname>Testconsument</surname>
<postal>9999ZZ</postal>
<street>Telecomlaan</street>
<housenumber>29</housenumber>
<housenumber_suffix>C</housenumber_suffix>
<city>Testerdam</city>
<product>Testsetje no. 30</product>
<color>Green</color>
</record>
</records>
Comments
Comment #1
websmash CreditAttribution: websmash commentedComment #2
DanChadwick CreditAttribution: DanChadwick commentedWebform doesn't offer that as a built-in format. I *think* the API allows additional formats to be defined -- you'd have to check the API file. Another thought would be to see if there is an XML output module for views and use the webform views integration.
Good luck.
Comment #4
joelrotelli CreditAttribution: joelrotelli commentedHi,
Here is a starting point to a solution to this problem.
I used the hook_webform_submission_insert() to create an XML file for each submission.
Comment #5
joelrotelli CreditAttribution: joelrotelli commentedYou also need to set an XML header : $xmlstr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";