One Star

How to save Base64 from XML to file ?

Hi,
I'm new to Talend and i've been searching all over the net about how to iterate an XML and save bytes to file.
I still didn't manage to understand how to get it done.
I have the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<row>
<actorid>1</actorid>
<name>AAA</name>
<pdf> SOME BASE64 STRING NEEDS TO BE CONVERTED TO BYTES AND SAVED TO FILE </pdf>
</row>
<row>
<actorid>2</actorid>
<name>BBB</name>
<pdf> SOME BASE64 STRING NEEDS TO BE CONVERTED TO BYTES AND SAVED TO FILE </pdf>
</row>
<row>
<actorid>3</actorid>
<name>CCC</name>
<pdf> SOME BASE64 STRING NEEDS TO BE CONVERTED TO BYTES AND SAVED TO FILE </pdf>
</row>
</root>
As I mentioned, I need to run over the XML --> convert each base64 string to bytes --> save it to file.
I do managed to read the input file and set a schema to it (You can see it in the attached image).
Any help ?
7 REPLIES
One Star

Re: How to save Base64 from XML to file ?

Any help ?
One Star

Re: How to save Base64 from XML to file ?

Hi,
If you search on the exchange platform (keyword: base64) you'll find a component and a routine collection which just might address your problem.
Good luck.
One Star

Re: How to save Base64 from XML to file ?

Hi,
1. What is "exchange platform" ?
2. Can you describe the message flow ? I'm very new to Talend and I can't figure out what should be the message flow.
Moderator

Re: How to save Base64 from XML to file ?

Hi,
Talend Exchange Platform is the place where Talend community can share items related to Talend open source products.
Here is a custom component tBase64 which allows you to encode/decode distinctly each dataset columns by base64 scheme.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: How to save Base64 from XML to file ?

@xdshi Thank you ! That really helps!
Just one more question:
How do I save each base64 to a file with custom file name convention ?
Thanks!
One Star

Re: How to save Base64 from XML to file ?

Still stuck.
Any help with saving multiple files with custom convention for each one ?
Six Stars

Re: How to save Base64 from XML to file ?

Did you ever solve your problem? I ran into the same issue.