Collect Assets Based on XML

Post Reply
StoereSjoerd
Newbie
Posts: 8
Joined: Thu Oct 29, 2015 3:51 pm

Collect Assets Based on XML

Post by StoereSjoerd »

Hi,

I would like to place assets in the correct folder based on the information within a XML file. I've one folder that contains the XML files and one folder that contains the PDF assets. Within the XML the asset names and order numbers are set:

Code: Select all

<Order>
  <OrderNumber>2340</OrderNumber>
  <Asset>hello.pdf</Asset>
</Order>
<Order>
  <OrderNumber>2341</OrderNumber>
  <Asset>bye.pdf</Asset>
</Order>
So asset 'hello.pdf' needs to be placed into folder '2340' and asset 'bye.pdf' into folder '2341'. I tried using XML pickup element, but I don't know how to walk through all the order numbers.

Regards, Sjoerd
sander
Advanced member
Posts: 276
Joined: Wed Oct 01, 2014 8:58 am
Location: The Netherlands

Re: Collect Assets Based on XML

Post by sander »

You can't loop through a unknown number of multiple nodes, easiest way would be to split your XML so you get 1 order per XML.

This is done over here: http://forum.enfocus.com/viewtopic.php?f=12&t=1201
StoereSjoerd
Newbie
Posts: 8
Joined: Thu Oct 29, 2015 3:51 pm

Re: Collect Assets Based on XML

Post by StoereSjoerd »

Ok, thank you Sander. That will be an option! Can loop through nodes with the scripting element be accomplished then?
bens
Advanced member
Posts: 253
Joined: Thu Mar 03, 2011 10:13 am

Re: Collect Assets Based on XML

Post by bens »

Yes with scripting you can parse xml as you wish. You can for example use the Node.evalToNodes() call to get a list of matching nodes, and then walk through them with a for loop.
Post Reply