Programming Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C Examples

Bounced Mail
Bz2
Certificates/Keys
Charset
CSV
DKIM / DomainKey
Diffie-Hellman
DSA
Email Object
Encryption
FileAccess
FTP
HTML Conversion
HTTP
IMAP
MHT / HTML Email
MIME
NTLM
POP3
RSA
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
Zip
Amazon S3

 

 

 

 

 

 

 

 

Load file into XML as Base64 Encoded Content

Loads 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.