I have an XML file with non unique duplicate xml elements with different values. I need these to migrated into taxonomy terms as well as nodes.

<xml>
  <note></note>
  <note type="admin">business</note>
  <note type="admin">gender</note>
</xml>

In prepare row I get an Array.

            [note] => Array
                (
                    [0] => SimpleXMLElement Object
                        (
                            [comment] => SimpleXMLElement Object
                                (
                                )

                        )

                    [1] => business
                    [2] => gender
                )

How do I iterate through this and return all values?

Comments

jeffwpetersen created an issue. See original summary.

jeffwpetersen’s picture

Issue summary: View changes
jeffwpetersen’s picture

Issue summary: View changes
jeffwpetersen’s picture

N/A

jeffwpetersen’s picture

Category: Support request » Bug report

And digging in I found this...
https://www.drupal.org/node/2506701

$this->destination = new MigrateDestinationTerm('style', array('allow_duplicate_terms' => TRUE));

Which then gives me another error.

stdClass Object
(
    [name] => Array
        (
            [0] => business
            [1] => gender
        )

    [vocabulary_machine_name] => themes
    [vid] => 3
    [parent] => Array
        (
            [0] => 0
        )

    [format] => plain_text
    [language] => und
    [migrate] => Array
        (
            [machineName] => themeTerm
        )

)
trim() expects parameter 1 to be string, array given                                                                                    [error]
File pendergast.com/pendergast/modules/taxonomy/taxonomy.module, line 628
Processed 2 (0 created, 0 updated, 2 failed, 0 ignored) in 0 sec (4510/min) - done with 'themeTerm' 

Switching this to a bug report.

jeffwpetersen’s picture

Title: Migrate non unique XML elements » Importing Multiple Taxonomy Terms from XML Fails.