Creating Folder From XML Data - Special Characters

Questions and answers on how to get the most out of FFAStrans
Post Reply
graham728
Posts: 82
Joined: Sat Oct 13, 2018 10:54 pm

Creating Folder From XML Data - Special Characters

Post by graham728 »

Hi,

I have set up a workflow to read XML Sidecars associated with MXF files. The XML details create the path in which to deliver the transcoded file.

It appears to be having trouble with the character : being in the folder name. It strangely is fine creating files with : in the name - it appears to auto remove it, just not from folders.

Is there a way to ignore special characters when reading XML/creating folders?

For exmplae FFAStrans is reading this field in the XML to create a folder:

<pn1:Campaign_Title>Example Title: Promo</pn1:Campaign_Title>

Thanks
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Creating Folder From XML Data - Special Characters

Post by emcodem »

Hey Graham,

so you already managed to construct the path to the xml files and read them successfully into a variable?
E.g. in a populate processor:

Code: Select all

%s_xml_content% =  $read("c:\temp\test.xml")
Also you already managed to extract the part of interest from the xml?

Code: Select all

%s_foldername% = $regext("%s_xml_content%","Campaign_Title>(.+?)<")
In that case, you have multiple options how to get rid of your ":" character. E.g. replace only the : character by _

Code: Select all

%s_foldername% = $replace("%s_foldername%",":", "_", 1) 
or, and a much better option when reading filenames from metadata fields that are not intended to carry filenames, replace all potentially unsafe characters by _

Code: Select all

%s_foldername% = $alrep("%s_foldername%","_")
All of the examples can be used in populate, but you don't write the left part %s_filename% = into the field but instead you select s_filename variable on the left side...

Does that make sense?
emcodem, wrapping since 2009 you got the rhyme?
graham728
Posts: 82
Joined: Sat Oct 13, 2018 10:54 pm

Re: Creating Folder From XML Data - Special Characters

Post by graham728 »

Hi,

Yes - someone on this forum kindly helped me set up the reading of XML's previously.

The workflow goes something like this.

MXF > Hold (wait for XML) > Pop Variables (attached 1) > Encode to H264 > Deliver to Folder (attachment 2).

It's within the folder delivery I'm using the string %s_xml_campaign_title% from the reading of the xml. This sometimes contains : which is stopping the delivery.

My Pop variables for reading the xml don't quite look like what you've entered below.
Attachments
2.PNG
2.PNG (26.37 KiB) Viewed 2886 times
1.PNG
1.PNG (58.3 KiB) Viewed 2886 times
graham728
Posts: 82
Joined: Sat Oct 13, 2018 10:54 pm

Re: Creating Folder From XML Data - Special Characters

Post by graham728 »

Got it figured - working with the below screenshot. Thanks for the help!

Replaced the folder delivery path from %s_xml_campaign_title% with s_foldername also.

Thanks again

Michael
Attachments
3.PNG
3.PNG (71.07 KiB) Viewed 2875 times
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Creating Folder From XML Data - Special Characters

Post by emcodem »

Well done, congrats 8-)
emcodem, wrapping since 2009 you got the rhyme?
Post Reply