Mime to XML

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
nekbmm
Posts: 129
Joined: Sat Jul 16, 2016 3:16 am
DBs Used: DBF,SQLite
Location: Ivanjica, Serbia

Mime to XML

Post by nekbmm »

Has anyone worked with the curl_mime _... functions I need to insert a .pdf file into XML, as the following example. Is there hbcurl.a for HMG_3.4.4?

Code: Select all

curlHandle: = curl_easy_init ()
mime = curl_mime_init (curlHandle)
  / * Add the attachment. * /
part = curl_mime_addpart (mime)
curl_mime_filedata (part, "Invoicexxx.pdf")
curl_mime_encoder (part, "base64")
? '<cbc: EmbeddedDocumentBinaryObject mimeCode = "application / pdf">' + part + '</ cbc: EmbeddedDocumentBinaryObject>'
Thanks in advance.
Nexbmm
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Mime to XML

Post by edk »

I guess the usual base64 encoding is enough, at least in the XML I was generating that was how it worked. Got a sample XML file?

Code: Select all

Base64part := HB_Base64Encode( FileStr ( cPathPdf ) )
cXml := '<cac:Attachment>' + CRLF
cXml += '<cbc:EmbeddedDocumentBinaryObject mimeCode="application/pdf">' + Base64part + '</cbc:EmbeddedDocumentBinaryObject>' + CRLF
cXml += '</cac:Attachment>' + CRLF
User avatar
nekbmm
Posts: 129
Joined: Sat Jul 16, 2016 3:16 am
DBs Used: DBF,SQLite
Location: Ivanjica, Serbia

Re: Mime to XML

Post by nekbmm »

I've tried it, it works perfectly!
Thanks edk!
Post Reply