1

I have some XML of the following structure to import into Drupal:

<list>
     <item id="0001" xml="http://www.example.com/0001.xml" dateChanged="24 June 2013 12:00:00"></item>
     <item id="0002" xml="http://www.example.com/0002.xml" dateChanged="24 June 2013 12:56:00"></item>
      ...
</list>

I have set up Migrate to run with cron every minute: read through the list, grab each item's XML and indiscriminately update the destination node. My Migrate source only uses the data from these linked documents, nothing from the list. But this is overkill. What I would like to do is to check the dateChanged dates, compare it to the corresponding last modified date in the node table, and only update the nodes that need it (if the corresponding XML doc has been updated). Can I do this with the last modified field as a highwater field?

  • I'd try a bit other approach - each minute (or rather 5-10 minutes) I would test if the XML document changed at all. Most of the times the answer will be "no", so no need to iterate. As far as I can tell Migrate is an API kind of module. Have you tried to write your module "with the last modified field as a highwater field"? Have you experienced any problems with it? Or is it a general question about something you can't find covered in the docs? – Mołot Jun 24 '13 at 13:01
  • I asked because of the structure of my XML and how I have defined my source. The doc I found regarding this said it probably only worked with DB to DB migrate. I'm not sure if the highwater field will work in a way that lets me reduce the number of requests I'm making. – loblawww Jun 24 '13 at 13:06
  • Can you even specify a highwater field as an xpath? The doc I read says what to do for a SQL source. Can I use 'xpath' => 'Item/@dateChanged' as my field? – loblawww Jun 25 '13 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.