Page 1 of 1
Creating Folder From XML Data - Special Characters
Posted: Thu May 12, 2022 4:27 pm
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
Re: Creating Folder From XML Data - Special Characters
Posted: Fri May 13, 2022 7:15 am
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?
Re: Creating Folder From XML Data - Special Characters
Posted: Fri May 13, 2022 3:49 pm
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.
Re: Creating Folder From XML Data - Special Characters
Posted: Fri May 13, 2022 5:06 pm
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
Re: Creating Folder From XML Data - Special Characters
Posted: Sat May 14, 2022 8:14 am
by emcodem
Well done, congrats