Search code examples
xmlxpathdrupaldrupal-feeds

Drupal 7: parsing xml with Feeds extensible parsers


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.


Solution

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

    context: /categories/category

    title: text()

    id: @id

    Thanks to twistor from drupal.org