XML PICK UP RESULTING FLOW

abonsey
Member
Posts: 98
Joined: Fri May 24, 2013 5:10 pm

XML PICK UP RESULTING FLOW

Post by abonsey »

I have an input folder which receives folders (XX-AA_BB)

Inside each folder is an xml file (XX_AA_BB.xml) and a PDF (XX_AA_BB.pdf)

When this new folder arrives I want to pick up the xml, read it and only look for an item within the xml (BB) for which I can read the data. The reason is that the xml contains multiple items and I'm only interested in a specific item.



1.How do I read the xml? Do I need some XSLT to make it work?

2.How do I identify just the one item (BB) from all the other items?



An example of this would be that (BB) is A4 and 200 copies. I want to then flow the PDF of the same name to the correct folder.
ArielRauch
Advanced member
Posts: 230
Joined: Thu Aug 07, 2014 10:04 am

XML PICK UP RESULTING FLOW

Post by ArielRauch »

I am not sure that I totally understood your final goal but:

1. to read the xml data you can use the XML pickup tool - it makes the data in the xml file "accessible". No, I do not think that you need xslt.

2. Either Xpath or if the structure of all XML files is the same you might access the specific tag directly.



Please elaborate a bit more about your goal and I might give some more assistance.



Ariel
abonsey
Member
Posts: 98
Joined: Fri May 24, 2013 5:10 pm

XML PICK UP RESULTING FLOW

Post by abonsey »

I cannot get the xml to be read even if I try the xml pickup as metadata is the asset. Without that I cannot progress further with the flow, that why I wanted Question 1 clarifying
ArielRauch
Advanced member
Posts: 230
Joined: Thu Aug 07, 2014 10:04 am

XML PICK UP RESULTING FLOW

Post by ArielRauch »

Is the XML valid - have you tried to read it with a browser?
abonsey
Member
Posts: 98
Joined: Fri May 24, 2013 5:10 pm

XML PICK UP RESULTING FLOW

Post by abonsey »

Hi,

The xml is valid, and I've now got it to work and can see the items :-)

That leads me onto question 2. How can I identify the correct item within the xml based on the xml filename containing (BB)? I need to be able to read just that part of the filename and select the correct item data based on the name



Thanks for your help
ArielRauch
Advanced member
Posts: 230
Joined: Thu Aug 07, 2014 10:04 am

XML PICK UP RESULTING FLOW

Post by ArielRauch »

reading only the BB part of the filename is easy - either script or "Define Text with variables" Job.NameProper and applying twice the "After" function.



Searching in XML depends on whether you know the tag to look at. Do you know where to look for it?
abonsey
Member
Posts: 98
Joined: Fri May 24, 2013 5:10 pm

XML PICK UP RESULTING FLOW

Post by abonsey »

Hi,

Thanks again. That works.

Does the flow have to be a 2 stage process because there is the need to identify the item, THEN read the variables for that item only?
ArielRauch
Advanced member
Posts: 230
Joined: Thu Aug 07, 2014 10:04 am

XML PICK UP RESULTING FLOW

Post by ArielRauch »

how did you read the variables in the end?
abonsey
Member
Posts: 98
Joined: Fri May 24, 2013 5:10 pm

XML PICK UP RESULTING FLOW

Post by abonsey »

Hi I read the item variable (BB) using using define text with variables. I'm just trying to understand how to ensure we only read the variable of BB only.

An example would be multiple items, each with stock size and quantity. I only want to read the stock size and quantity of BB and THEN flow the pdf accordingly.
abonsey
Member
Posts: 98
Joined: Fri May 24, 2013 5:10 pm

XML PICK UP RESULTING FLOW

Post by abonsey »



BB" Rush="No" type="New" approved="Yes" WaitingScheduler="No">







Business Card

250



I want to ensure I only use the item with line number BB and read the correct quantity
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

XML PICK UP RESULTING FLOW

Post by dkelly »

/Items/Item[@LineNumber='BB']/Quantity
abonsey
Member
Posts: 98
Joined: Fri May 24, 2013 5:10 pm

XML PICK UP RESULTING FLOW

Post by abonsey »

How would you use a variable for "BB" ie JobName?
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

XML PICK UP RESULTING FLOW

Post by dkelly »

Using multi-line text with variables: /Items/Item[@LineNumber='[Job.Name]']/Quantity
abonsey
Member
Posts: 98
Joined: Fri May 24, 2013 5:10 pm

XML PICK UP RESULTING FLOW

Post by abonsey »

thanks for all the help.

I got the static version to work: [Metadata.Text:Path="/Request/Items/Item[@LineNumber='PM2628']/Quantity",Dataset="Xml",Model="XML"]





But failed with the variable version: [Metadata.Text:Path="/Request/Items/Item[@LineNumber='[Job.NameProper:After_]']/Quantity",Dataset="Xml",Model="XML"]



I get an error about the unexpected _ appearing



Any ideas??
freddyp
Advanced member
Posts: 413
Joined: Thu Feb 09, 2012 3:53 pm

XML PICK UP RESULTING FLOW

Post by freddyp »

You cannot use variables inside XPath expressions. First, there is the clash of quotation marks within quotation marks (that explains the error message you see), but second, even when you use some variable that does not use quotation marks, you will see the variable does not get resolved.



With a script expression you can build the XPath you need.



Freddy
Post Reply