Link to home
Start Free TrialLog in
Avatar of ramramcat
ramramcatFlag for United States of America

asked on

Import XML file with Base64 image element

Hi:
I have a VFP-9 application that imports data from an XML and prints a report for each record imported, which is output in multiple formats (eg: PDF, etc.).
The client is now including an image element (field) that they need printed on the report. They describe the XML element as varbinary(max) Base64 encoded (from SQL server). When I run the XMLTOCURSOR command, this new field is output in a Memo field. I am having trouble converting this long string to an image, or anything else for that matter.
I have tried including STRCONV, as follows, but that didn't work and issued error #1435.
          XMLTOCURSOR(STRCONV("Sample.xml", 14),"test", 512)
Any ideas on how I can import the XML, including the Base64 encoded image file to VFP and access the image for printing on the report along with the data fields?
Thanks in advance.
Cathie
NYC
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

You will probably have to export the base-64 to a file and have an external program decode it to an image format for you.  I hope they included the image name with the proper extension for you.  There are a lot of online decoders but here https://sourceforge.net/projects/base64/ is one that you can download and run.
ASKER CERTIFIED SOLUTION
Avatar of Olaf Doschke
Olaf Doschke
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ramramcat

ASKER

Hi Olaf:
Your concept of processing the XMLTOCURSOR first and then scanning and converting the Base64 field works perfectly. I do not have original filenames for the images but the client told me that they were BMP files. Thank you!
Cathie