How to import multiple terms from XML into a node? I am trying to import all the Destinations as taxonomy terms using following XML. In my situation, the list is not a comma separated list. It is as follows:

&lt;product&gt;
    &lt;category&gt;Ship&lt;/category&gt;
    &lt;id&gt;000032&lt;/id&gt;
    &lt;Description&gt;The description comes here&lt;/Description&gt;
    &lt;list&gt;
        &lt;Destination&gt;
            &lt;DestinationName&gt;Dest 1&lt;/DestinationName&gt;
            &lt;DestinationCountryISOAlpha3&gt;US&lt;/DestinationCountryISOAlpha3&gt;
        &lt;/Destination&gt;
        &lt;Destination&gt;
            &lt;DestinationName&gt;Dest 2&lt;/DestinationName&gt;
            &lt;DestinationCountryISOAlpha3/&gt;
        &lt;/Destination&gt;
    &lt;list&gt;
&lt;/product&gt;


I have a taxonomy called destinations and the list is already imported. Now how can I import Destinations list of a product as a term reference for the product node. I am using feed module, Feeds XPath Parser, and Feeds Tamper modules?
I finally found a way to achieve this goal at least for my use case. Publish my solution here for anyone to use if required.

My Settings for XPath XML parser :

Context -&gt; //product/list/Destination
Product id -&gt; ../../id
List of ports -&gt; DestinationName # This is a term reference field which well have multiple terms per product


Then mapped all required fields as normal.

I created a small module with hook_feeds_after_parse() hook (I will use "My module").

My module has one .info file and the .module file.

function my_module_feeds_after_parse(FeedsSource $source, FeedsParserResult $result) {
    $current_id = -1;
    $cuurent_destination_list_final = '';
    foreach($result-&gt;items as $key =&gt; $row) {
        if($current_id !== $row['xpathparser:0']){
            $cuurent_destination_list_final = '';
            $current_id = $row['xpathparser:0'];
        }
        if($cuurent_destination_list_final === ''){
            $cuurent_destination_list_final = $row['xpathparser:1'];
        }else{
            $cuurent_destination_list_final = $cuurent_destination_list_final . ',' . $row['xpathparser:1'];
        }
        $result-&gt;items[$key]['destination_list_final'] = $cuurent_destination_list_final;
    }
}


What this module does is it creates a comma separated list of destinations.
Once we set $result->items[$key]['destination_list_final'] (This builds a comma separated list of terms) using this module, we can refer destination_list_final from Feeds Tamper (Refer this). 

Install and enable Feeds Tamper PHP. 
Add 3 pluggings to xpathparser:1 -&gt; List of Destinations


Execute php code (This come from above installed module) -> return     $item['destination_list_final'];
Find replace - Use to remove double quotes (")
Explode - Use to explode the comma separated list we created from the custom module. 


That's it. It worked for me.