Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Load file into XML as Base64 Encoded ContentLoads any type file into an XML document. The file content is encoded as base64. Downloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries FreeBSD C++ Libraries HP-UX C++ Libraries BlackBerry QNX C++ Libraries #include <C_CkXml.h> void ChilkatSample(void) { HCkXml docRoot; BOOL success; BOOL zipContent; BOOL encryptContent; const char * encryptPassword; HCkXml pdfNode; BOOL unzipContent; BOOL decryptContent; const char * decryptPassword; docRoot = CkXml_Create(); CkXml_putTag(docRoot,"myDoc"); // To zip compress the content, set this flag to TRUE zipContent = FALSE; // To 128-bit AES encrypt the content, set this flag to TRUE encryptContent = FALSE; encryptPassword = ""; pdfNode = CkXml_NewChild(docRoot,"pdf",""); // Embed a PDF into XML success = CkXml_SetBinaryContentFromFile(pdfNode,"sample.pdf",zipContent,encryptContent,encryptPassword); if (success != TRUE) { printf("%s\n",CkXml_lastErrorText(pdfNode)); CkXml_Dispose(pdfNode); return; } printf("%s\n",CkXml_lastErrorText(pdfNode)); // Display the entire XML document: printf("%s\n",CkXml_getXml(docRoot)); // Get the Base64-encoded content and display it: printf("%s\n",CkXml_content(pdfNode)); // Extract the binary content from XML: unzipContent = FALSE; decryptContent = FALSE; decryptPassword = ""; success = CkXml_SaveBinaryContent(pdfNode,"out.pdf",unzipContent,decryptContent,decryptPassword); if (success != TRUE) { printf("%s\n",CkXml_lastErrorText(pdfNode)); CkXml_Dispose(pdfNode); return; } CkXml_Dispose(pdfNode); printf("Success!\n"); CkXml_Dispose(docRoot); } |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.