ramramcat
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("Sampl e.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
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("Sampl
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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