Drupal 7: parsing xml with Feeds extensible parsers

449 Views Asked by At

Good day.

I have such an xml file:

<categories>
    <category id="1">Cat. 1</category>
    <category id="2">Cat. 2</category>
</categories>

All I need is to import category as term to my vocbulary. But I can't figure out how to do such thing. My problem is that I cant configure importer properly. Next thing doesn't work, cuz title will be empty:

context: //categories/*
id: @id
title: category 

If I go another way

context: /categories
title: category
id: category/@id

I will recieve two arrays: titles, id's. No taxonomy term will be added due to data type (array). So I can't split that array to get 1 (title,id) => 1 new term.

2

There are 2 best solutions below

0
On BEST ANSWER

Answer is here https://www.drupal.org/node/2542928#comment-10178930

context: /categories/category

title: text()

id: @id

Thanks to twistor from drupal.org

1
On

Take a look at the Feeds Tamper module, it gives you the ability to make changes to the data before Feeds imports it.