$item_xpath = 'TITLE/CHAPTER/PART/SECTION';
$item_ID_xpath = 'SECTNO'
I want to get TITLE, CHAPTER and PART for each sectno (id).

A friend was telling me about an arg() function. Where to find more information on this, i don't see it in the migrate module. Can someone point me in the right direction on how to achieve this?

Comments

mikeryan’s picture

Status: Active » Postponed (maintainer needs more info)

Well, that's tricky in your case. If you're using one of the SimpleXML-based source plugins - MigrateItemXML or MigrateItemsXML - you can use the full XPath syntax, which uses .. to get to parents (see http://www.w3schools.com/xpath/xpath_syntax.asp). However, in your other issue you indicate you're trying to pull multiple XML files, which requires MigrateSourceXML - because that plugin depends on the PHP XMLReader extension, it does not support the full XPath syntax, and you would have to override the MigrateXMLReader class and have it keep track of the parent values you want while it's parsing.

jumoke’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Hi Mike, thank you for pointing me in the right direction. I went back to doing MigrateItemsXML and XPath did the trick and what I'll have to do on the issue of multiple XML files is to write multiple functions to migrate the XML files separately :)

dropfen’s picture

Hi Mike, is there really no way, to get MigrateItemsXML work as 2. parameter inside the MigrateSourceList?
It would be the best solution for this Issue.

My use case:

* ~500 URLs to Feeds
* ~250 Items per Feed (~1mb)
* Need to query the file as flexible as possible (full XPath support would be very nice).
* migrate process time is not important.

As you described before, only with MigrateItem(s)XML it's possible to use the full Xpath syntax.
I would be ready to help contribute, but need a bit more practice in OOP. Maybe you can make a fresh Issue
to discuss the possibilities, how to do this?

Thank you very much, dropfen

EDIT:

got it to work http://drupal.org/node/1998632